Browse Source

Bugfix: Assign header-based rolltime before decoding work, so GBT expires overrides it properly

Luke Dashjr 13 years ago
parent
commit
6342458c4a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      miner.c

+ 2 - 2
miner.c

@@ -4589,12 +4589,12 @@ tryagain:
 		if ((!json_is_object(res)) || (proto == PLP_GETBLOCKTEMPLATE && !json_object_get(res, "bits")))
 			goto badwork;
 
+		work->rolltime = rolltime;
 		rc = work_decode(res, work);
 		if (rc) {
 			applog(LOG_DEBUG, "Successfully retrieved and deciphered work from pool %u %s",
 			       pool->pool_no, pool->rpc_url);
 			work->pool = pool;
-			work->rolltime = rolltime;
 			applog(LOG_DEBUG, "Pushing pooltest work to base pool");
 
 			tq_push(thr_info[stage_thr_id].q, work);
@@ -5200,6 +5200,7 @@ static void convert_to_work(json_t *val, int rolltime, struct pool *pool, struct
 {
 	bool rc;
 
+	work->rolltime = rolltime;
 	rc = work_decode(json_object_get(val, "result"), work);
 	if (unlikely(!rc)) {
 		applog(LOG_ERR, "Could not convert longpoll data to work");
@@ -5207,7 +5208,6 @@ static void convert_to_work(json_t *val, int rolltime, struct pool *pool, struct
 		return;
 	}
 	work->pool = pool;
-	work->rolltime = rolltime;
 	work->longpoll = true;
 
 	if (pool->enabled == POOL_REJECTING)