summaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorDeepesh Pathak <deepshpathak@gmail.com>2018-02-03 06:45:52 +0530
committerDeepesh Pathak <deepshpathak@gmail.com>2018-02-03 06:45:52 +0530
commit1c8f55310f6a9969dc8ae5e8566e971fd2ac50b4 (patch)
tree123436185db58443eadf1af20ca7cb21c4b3a787 /src/or/networkstatus.c
parent953c769a867415f81dc016f30575dee6c0b2cb43 (diff)
downloadtor-1c8f55310f6a9969dc8ae5e8566e971fd2ac50b4.tar.gz
tor-1c8f55310f6a9969dc8ae5e8566e971fd2ac50b4.zip
Rename a verified unverified-consensus to cached-consensus on the disk
- Fixes ticket #4187 - Change the name of a unverified-*consensus to cached-*consensus on disk when it has been verified.
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 31ecb20985..2a83bf008c 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -237,7 +237,7 @@ router_reload_consensus_networkstatus(void)
s = networkstatus_read_cached_consensus_impl(flav, flavor, 1);
if (s) {
if (networkstatus_set_current_consensus(s, flavor,
- flags|NSSET_WAS_WAITING_FOR_CERTS,
+ flags | NSSET_WAS_WAITING_FOR_CERTS,
NULL)) {
log_info(LD_FS, "Couldn't load unverified consensus %s networkstatus "
"from cache", flavor);
@@ -1928,6 +1928,15 @@ networkstatus_set_current_consensus(const char *consensus,
}
}
+ /* Signatures from the consensus are verified */
+ if (from_cache && was_waiting_for_certs) {
+ /* We check if the consensus is loaded from disk cache and that it
+ * it is an unverified consensus. If it is unverified, rename it to
+ * cached-*-consensus since it has been verified. */
+ log_info(LD_DIR, "Unverified consensus signatures verified.");
+ tor_rename(unverified_fname, consensus_fname);
+ }
+
if (!from_cache && flav == usable_consensus_flavor())
control_event_client_status(LOG_NOTICE, "CONSENSUS_ARRIVED");