Browse Source

New pool option "retrodiff"

Vitalii Demianets 11 years ago
parent
commit
1600d497d0
2 changed files with 14 additions and 8 deletions
  1. 13 8
      miner.c
  2. 1 0
      miner.h

+ 13 - 8
miner.c

@@ -1216,6 +1216,7 @@ static
 void pool_set_uri(struct pool * const pool, char * const uri)
 void pool_set_uri(struct pool * const pool, char * const uri)
 {
 {
 	pool->rpc_url = uri;
 	pool->rpc_url = uri;
+	pool->pool_diff_effective_retroactively = uri_get_param_bool(uri, "retrodiff", false);
 }
 }
 
 
 /* Pool variant of test and set */
 /* Pool variant of test and set */
@@ -10536,15 +10537,19 @@ enum test_nonce2_result _test_nonce2(struct work *work, uint32_t nonce, bool che
 		struct pool * const pool = work->pool;
 		struct pool * const pool = work->pool;
 		if (pool->stratum_active)
 		if (pool->stratum_active)
 		{
 		{
-			// Some stratum pools are buggy and expect difficulty changes to be immediate retroactively, so if the target has changed, check and submit just in case
-			if (memcmp(pool->next_target, work->target, sizeof(work->target)))
+			if (pool->pool_diff_effective_retroactively)
 			{
 			{
-				applog(LOG_DEBUG, "Stratum pool %u target has changed since work job issued, checking that too",
-				       pool->pool_no);
-				if (hash_target_check_v(work->hash, pool->next_target)) {
-					high_hash = false;
-					memcpy(work->target, pool->next_target, sizeof(work->target));
-					calc_diff(work, 0);
+				// Some stratum pools are buggy and expect difficulty changes to be immediate retroactively, so if the target has changed, check and submit just in case
+				if (memcmp(pool->next_target, work->target, sizeof(work->target)))
+				{
+					applog(LOG_DEBUG, "Stratum pool %u target has changed since work job issued, checking that too as requested by user",
+					       pool->pool_no);
+					if (hash_target_check_v(work->hash, pool->next_target))
+					{
+						high_hash = false;
+						memcpy(work->target, pool->next_target, sizeof(work->target));
+						calc_diff(work, 0);
+					}
 				}
 				}
 			}
 			}
 		}
 		}

+ 1 - 0
miner.h

@@ -1361,6 +1361,7 @@ struct pool {
 	char work_restart_timestamp[11];
 	char work_restart_timestamp[11];
 	uint32_t	block_id;
 	uint32_t	block_id;
 	struct mining_goal_info *goal;
 	struct mining_goal_info *goal;
+	bool pool_diff_effective_retroactively;
 
 
 	enum pool_protocol proto;
 	enum pool_protocol proto;