aboutsummaryrefslogtreecommitdiff
path: root/src/or/test.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-08-15 16:12:40 +0000
committerNick Mathewson <nickm@torproject.org>2007-08-15 16:12:40 +0000
commit38b84d9659980af5bca71d546f17acc83e0d1a68 (patch)
tree66c082360c6db6268de104482733717ee200c443 /src/or/test.c
parentd5bd7d9fa39971d24859493e62e1d3ba3d1dc906 (diff)
downloadtor-38b84d9659980af5bca71d546f17acc83e0d1a68.tar.gz
tor-38b84d9659980af5bca71d546f17acc83e0d1a68.zip
r14043@Kushana: nickm | 2007-08-15 12:12:25 -0400
Fix consensus signatures: regenerate the entire signature list when we get a new signature, rather than just appending the new signature. This lets us tentatively accept weird signatures, since we can replace them with better ones later. svn:r11122
Diffstat (limited to 'src/or/test.c')
-rw-r--r--src/or/test.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/test.c b/src/or/test.c
index e10ebc2d27..2df0785f03 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -2769,6 +2769,7 @@ test_v3_networkstatus(void)
char *detached_text1, *addition1, *detached_text2, *addition2;
ns_detached_signatures_t *dsig1, *dsig2;
size_t sz;
+ int regen;
/* Compute the other two signed consensuses. */
smartlist_shuffle(votes);
consensus_text2 = networkstatus_compute_consensus(votes, 3,
@@ -2812,7 +2813,8 @@ test_v3_networkstatus(void)
/* Try adding it to con2. */
detached_text2 = networkstatus_get_detached_signatures(con2);
addition1 = NULL;
- test_eq(1, networkstatus_add_detached_signatures(con2, dsig1, &addition1));
+ test_eq(1, networkstatus_add_detached_signatures(con2, dsig1, &addition1,
+ &regen));
sz = strlen(detached_text2)+strlen(addition1)+1;
detached_text2 = tor_realloc(detached_text2, sz);
strlcat(detached_text2, addition1, sz);
@@ -2830,10 +2832,12 @@ test_v3_networkstatus(void)
test_eq(2, smartlist_len(dsig2->signatures));
/* Try adding to con2 twice; verify that nothing changes. */
- test_eq(0, networkstatus_add_detached_signatures(con2, dsig1, &addition2));
+ test_eq(0, networkstatus_add_detached_signatures(con2, dsig1, &addition2,
+ &regen));
/* Add to con. */
- test_eq(2, networkstatus_add_detached_signatures(con, dsig2, &addition2));
+ test_eq(2, networkstatus_add_detached_signatures(con, dsig2, &addition2,
+ &regen));
/* Check signatures */
test_assert(!networkstatus_check_voter_signature(con,
smartlist_get(con->voters, 0),