prop224: HS revision counter should persist after service reboot
We currently have the following logic in the HSDir-side when accepting an HS descriptor:
if (cache_entry->plaintext_data->revision_counter >=
desc->plaintext_data->revision_counter) {
log_info(LD_REND, "Descriptor revision counter in our cache is "
"greater or equal than the one we received. "
"Rejecting!");
goto err;
}
Unfortunately, while HSes keep track of the revision counter in memory, they never save it on disk, so if the service reboots the Hs will lose track of the rev counter and publish descriptors with small counters that will get rejected by the HSDir.
We have brainstormed the following solutions for this:
a) Save the latest rev counter in the state file in a form like this:
HidServRevCounter <service_pubkey> <rev_counter> <time_period_num>
b) Set the rev counter to a value like rounddown(time(NULL))
so that the HS always generates correct rev counters even without saving them on state.
However, wrt (b), since the quoted check above rejects equal rev counters the HS will have trouble uploading descriptors in the same hour. We could backport a fix that changes the check to 0.3.0 and then do this idea but that's kind of a PITA.
We are currently aiming for (a)