diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-08-09 14:00:30 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-08-09 14:00:30 -0400 |
commit | fed3a08d8c32f2010caba06c888f28716e3abb0a (patch) | |
tree | c3f965dd1d46890e1d42ae23a3a8dd7cf65908be /src | |
parent | fc212458a67e1bc27a6456609b02eb703ef7be05 (diff) | |
download | tor-fed3a08d8c32f2010caba06c888f28716e3abb0a.tar.gz tor-fed3a08d8c32f2010caba06c888f28716e3abb0a.zip |
Support the ed25519 map in nodelist_assert_ok()
Diffstat (limited to 'src')
-rw-r--r-- | src/or/nodelist.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 93d362d8e2..104915d293 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -725,9 +725,27 @@ nodelist_assert_ok(void) tor_assert(node_sl_idx == node->nodelist_idx); } SMARTLIST_FOREACH_END(node); + /* Every node listed with an ed25519 identity should be listed by that + * identity. + */ + SMARTLIST_FOREACH_BEGIN(the_nodelist->nodes, node_t *, node) { + if (!ed25519_public_key_is_zero(&node->ed25519_id)) { + tor_assert(node == node_get_by_ed25519_id(&node->ed25519_id)); + } + } SMARTLIST_FOREACH_END(node); + + node_t **idx; + HT_FOREACH(idx, nodelist_ed_map, &the_nodelist->nodes_by_ed_id) { + node_t *node = *idx; + tor_assert(node == node_get_by_ed25519_id(&node->ed25519_id)); + } + tor_assert((long)smartlist_len(the_nodelist->nodes) == (long)HT_SIZE(&the_nodelist->nodes_by_id)); + tor_assert((long)smartlist_len(the_nodelist->nodes) >= + (long)HT_SIZE(&the_nodelist->nodes_by_ed_id)); + digestmap_free(dm, NULL); } |