|
|
@@ -2839,19 +2839,21 @@ bool pool_may_redirect_to(struct pool * const pool, const char * const uri)
|
|
|
return match_domains(pool->rpc_url, strlen(pool->rpc_url), uri, strlen(uri));
|
|
|
}
|
|
|
|
|
|
-void set_simple_ntime_roll_limit(struct ntime_roll_limits * const nrl, const uint32_t ntime_base, const int ntime_roll)
|
|
|
+void set_simple_ntime_roll_limit(struct ntime_roll_limits * const nrl, const uint32_t ntime_base, const int ntime_roll, const struct timeval * const tvp_ref)
|
|
|
{
|
|
|
+ const int offsets = max(ntime_roll, 60);
|
|
|
*nrl = (struct ntime_roll_limits){
|
|
|
.min = ntime_base,
|
|
|
.max = ntime_base + ntime_roll,
|
|
|
- .minoff = -ntime_roll,
|
|
|
- .maxoff = ntime_roll,
|
|
|
+ .tv_ref = *tvp_ref,
|
|
|
+ .minoff = -offsets,
|
|
|
+ .maxoff = offsets,
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-void work_set_simple_ntime_roll_limit(struct work * const work, const int ntime_roll)
|
|
|
+void work_set_simple_ntime_roll_limit(struct work * const work, const int ntime_roll, const struct timeval * const tvp_ref)
|
|
|
{
|
|
|
- set_simple_ntime_roll_limit(&work->ntime_roll_limits, upk_u32be(work->data, 0x44), ntime_roll);
|
|
|
+ set_simple_ntime_roll_limit(&work->ntime_roll_limits, upk_u32be(work->data, 0x44), ntime_roll, tvp_ref);
|
|
|
}
|
|
|
|
|
|
#if BLKMAKER_VERSION > 1
|
|
|
@@ -3053,6 +3055,7 @@ static bool work_decode(struct pool *pool, struct work *work, json_t *val)
|
|
|
work->ntime_roll_limits = (struct ntime_roll_limits){
|
|
|
.min = tmpl->mintime,
|
|
|
.max = tmpl->maxtime,
|
|
|
+ .tv_ref = tv_now,
|
|
|
.minoff = tmpl->mintimeoff,
|
|
|
.maxoff = tmpl->maxtimeoff,
|
|
|
};
|
|
|
@@ -3078,7 +3081,7 @@ static bool work_decode(struct pool *pool, struct work *work, json_t *val)
|
|
|
return false;
|
|
|
}
|
|
|
else
|
|
|
- work_set_simple_ntime_roll_limit(work, 0);
|
|
|
+ work_set_simple_ntime_roll_limit(work, 0, &tv_now);
|
|
|
|
|
|
if (!jobj_binary(res_val, "midstate", work->midstate, sizeof(work->midstate), false)) {
|
|
|
// Calculate it ourselves
|
|
|
@@ -5114,9 +5117,11 @@ void get_benchmark_work(struct work *work, bool use_swork)
|
|
|
{
|
|
|
if (use_swork)
|
|
|
{
|
|
|
+ struct timeval tv_now;
|
|
|
+ timer_set_now(&tv_now);
|
|
|
gen_stratum_work(pools[0], work);
|
|
|
work->getwork_mode = GETWORK_MODE_BENCHMARK;
|
|
|
- work_set_simple_ntime_roll_limit(work, 0);
|
|
|
+ work_set_simple_ntime_roll_limit(work, 0, &tv_now);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -5141,7 +5146,7 @@ void get_benchmark_work(struct work *work, bool use_swork)
|
|
|
copy_time(&work->tv_staged, &work->tv_getwork);
|
|
|
work->getwork_mode = GETWORK_MODE_BENCHMARK;
|
|
|
calc_diff(work, 0);
|
|
|
- work_set_simple_ntime_roll_limit(work, 60);
|
|
|
+ work_set_simple_ntime_roll_limit(work, 60, &work->tv_getwork);
|
|
|
}
|
|
|
|
|
|
static void wake_gws(void);
|
|
|
@@ -5644,7 +5649,7 @@ static void roll_work(struct work *work)
|
|
|
ntime = be32toh(*work_ntime);
|
|
|
ntime++;
|
|
|
*work_ntime = htobe32(ntime);
|
|
|
- work_set_simple_ntime_roll_limit(work, 0);
|
|
|
+ work_set_simple_ntime_roll_limit(work, 0, &work->ntime_roll_limits.tv_ref);
|
|
|
|
|
|
applog(LOG_DEBUG, "Successfully rolled time header in work");
|
|
|
}
|