Browse Source

add_local_gbt: Avoid adding servers already configured

Luke Dashjr 11 years ago
parent
commit
a2baa4f077
1 changed files with 12 additions and 0 deletions
  1. 12 0
      miner.c

+ 12 - 0
miner.c

@@ -11035,6 +11035,18 @@ err:
 		snprintf(hfuri, sizeof(hfuri), "port %d", rpcport);
 	applog(LOG_DEBUG, "Local bitcoin RPC server on %s found in %s", hfuri, filepath);
 	
+	for (int i = 0; i < total_pools; ++i)
+	{
+		struct pool *pool = pools[i];
+		
+		if (!(strcmp(pool->rpc_url, uri) || strcmp(pool->rpc_pass, rpcpass)))
+		{
+			applog(LOG_DEBUG, "Server on %s is already configured, not adding as failover", hfuri);
+			free(uri);
+			goto err;
+		}
+	}
+	
 	pool = add_pool();
 	if (!pool)
 	{