/* If the descriptor contains PoW parameters then the service is
* expecting a PoW solution in the INTRODUCE cell, which we solve here. */
- if (desc->encrypted_data.pow_params) {
+ if (desc->encrypted_data.pow_params &&
+ desc->encrypted_data.pow_params->suggested_effort > 0) {
log_debug(LD_REND, "PoW params present in descriptor.");
pow_solution = tor_malloc_zero(sizeof(hs_pow_solution_t));
int ok;
unsigned long effort =
- tor_parse_ulong(tok->args[2], 10, 1, UINT32_MAX, &ok, NULL);
+ tor_parse_ulong(tok->args[2], 10, 0, UINT32_MAX, &ok, NULL);
if (!ok) {
log_warn(LD_REND, "Unparseable suggested effort %s in PoW params",
escaped(tok->args[2]));
/* Services SHOULD NOT upload a new descriptor if the suggested
* effort value changes by less than 15 percent. */
previous_effort = encrypted->pow_params->suggested_effort;
- if (pow_state->suggested_effort <= previous_effort * 0.85 ||
- previous_effort * 1.15 <= pow_state->suggested_effort) {
+ if (pow_state->suggested_effort < previous_effort * 0.85 ||
+ previous_effort * 1.15 < pow_state->suggested_effort) {
log_info(LD_REND, "Suggested effort changed significantly, "
"updating descriptors...");
encrypted->pow_params->suggested_effort = pow_state->suggested_effort;
descs_updated = 1;
} else if (previous_effort != pow_state->suggested_effort) {
/* The change in suggested effort was not significant enough to
- warrant updating the descriptors, return 0 to reflect they are
- unchanged. */
+ * warrant updating the descriptors, return 0 to reflect they are
+ * unchanged. */
log_info(LD_REND, "Change in suggested effort didn't warrant "
"updating descriptors.");
}