Skip to content

Commit c2245a9

Browse files
committed
eth-proxy compatibility
1 parent 443f549 commit c2245a9

8 files changed

+236
-130
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
cmake_minimum_required(VERSION 2.8.12)
33

44
set(PROJECT_VERSION "0.9.41")
5-
set(GENOIL_VERSION "1.1.6")
5+
set(GENOIL_VERSION "1.1.7")
66
if (${CMAKE_VERSION} VERSION_GREATER 3.0)
77
cmake_policy(SET CMP0042 OLD) # fix MACOSX_RPATH
88
cmake_policy(SET CMP0048 NEW) # allow VERSION argument in project()

ethminer/MinerAux.h

+33-49
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class MinerCLI
188188
if (p + 1 <= userpass.length())
189189
m_pass = userpass.substr(p+1);
190190
}
191-
else if ((arg == "-SV" || arg == "--stratum-version") && i + 1 < argc)
191+
else if ((arg == "-SC" || arg == "--stratum-client") && i + 1 < argc)
192192
{
193193
try {
194194
m_stratumClientVersion = atoi(argv[++i]);
@@ -201,9 +201,27 @@ class MinerCLI
201201
BOOST_THROW_EXCEPTION(BadArgument());
202202
}
203203
}
204-
else if (arg == "-ES" || arg == "--ethereum-stratum")
204+
else if ((arg == "-SP" || arg == "--stratum-protocol") && i + 1 < argc)
205205
{
206-
m_ethereumStratum = true;
206+
try {
207+
m_stratumProtocol = atoi(argv[++i]);
208+
}
209+
catch (...)
210+
{
211+
cerr << "Bad " << arg << " option: " << argv[i] << endl;
212+
BOOST_THROW_EXCEPTION(BadArgument());
213+
}
214+
}
215+
else if ((arg == "-SE" || arg == "--stratum-email") && i + 1 < argc)
216+
{
217+
try {
218+
m_email = string(argv[++i]);
219+
}
220+
catch (...)
221+
{
222+
cerr << "Bad " << arg << " option: " << argv[i] << endl;
223+
BOOST_THROW_EXCEPTION(BadArgument());
224+
}
207225
}
208226
else if ((arg == "-FO" || arg == "--failover-userpass") && i + 1 < argc)
209227
{
@@ -400,47 +418,6 @@ class MinerCLI
400418
{
401419
m_minerType = MinerType::Mixed;
402420
}
403-
/*
404-
else if (arg == "--current-block" && i + 1 < argc)
405-
m_currentBlock = stol(argv[++i]);
406-
else if ((arg == "-w" || arg == "--check-pow") && i + 4 < argc)
407-
{
408-
string m;
409-
try
410-
{
411-
Ethash::BlockHeader bi;
412-
m = boost::to_lower_copy(string(argv[++i]));
413-
h256 powHash(m);
414-
m = boost::to_lower_copy(string(argv[++i]));
415-
h256 seedHash;
416-
if (m.size() == 64 || m.size() == 66)
417-
seedHash = h256(m);
418-
else
419-
seedHash = EthashAux::seedHash(stol(m));
420-
m = boost::to_lower_copy(string(argv[++i]));
421-
bi.setDifficulty(u256(m));
422-
auto boundary = bi.boundary();
423-
m = boost::to_lower_copy(string(argv[++i]));
424-
bi.setNonce(h64(m));
425-
auto r = EthashAux::eval(seedHash, powHash, bi.nonce());
426-
bool valid = r.value < boundary;
427-
cout << (valid ? "VALID :-)" : "INVALID :-(") << endl;
428-
cout << r.value << (valid ? " < " : " >= ") << boundary << endl;
429-
cout << " where " << boundary << " = 2^256 / " << bi.difficulty() << endl;
430-
cout << " and " << r.value << " = ethash(" << powHash << ", " << bi.nonce() << ")" << endl;
431-
cout << " with seed as " << seedHash << endl;
432-
if (valid)
433-
cout << "(mixHash = " << r.mixHash << ")" << endl;
434-
cout << "SHA3( light(seed) ) = " << sha3(EthashAux::light(bi.seedHash())->data()) << endl;
435-
exit(0);
436-
}
437-
catch (...)
438-
{
439-
cerr << "Bad " << arg << " option: " << m << endl;
440-
BOOST_THROW_EXCEPTION(BadArgument());
441-
}
442-
}
443-
*/
444421
else if (arg == "-M" || arg == "--benchmark")
445422
{
446423
mode = OperationMode::Benchmark;
@@ -603,8 +580,12 @@ class MinerCLI
603580
<< " -O, --userpass <username.workername:password> Stratum login credentials" << endl
604581
<< " -FO, --failover-userpass <username.workername:password> Failover stratum login credentials (optional, will use normal credentials when omitted)" << endl
605582
<< " --work-timeout <n> reconnect/failover after n seconds of working on the same (stratum) job. Defaults to 180. Don't set lower than max. avg. block time" << endl
606-
<< " -SV, --stratum-version <n> Stratum client version. Defaults to 1 (async client). Use 2 to test new synchronous client." << endl
607-
<< " -ES, --ethereum-stratum Use EthereumStratum/1.0.0 mode." << endl
583+
<< " -SC, --stratum-client <n> Stratum client version. Defaults to 1 (async client). Use 2 to use the new synchronous client." << endl
584+
<< " -SP, --stratum-protocol <n> Choose which stratum protocol to use:" << endl
585+
<< " 0: official stratum spec: ethpool, ethermine, coinotron, mph, nanopool (default)" << endl
586+
<< " 1: eth-proxy compatible: dwarfpool, f2pool, nanopool" << endl
587+
<< " 2: EthereumStratum/1.0.0: nicehash" << endl
588+
<< " -SE, --stratum-email <s> Email address used in eth-proxy (optional)" << endl
608589
#endif
609590
#if ETH_JSONRPC || ETH_STRATUM || !ETH_TRUE
610591
<< " --farm-recheck <n> Leave n ms between checks for changed work (default: 500). When using stratum, use a high value (i.e. 2000) to get more stable hashrate output" << endl
@@ -930,6 +911,7 @@ class MinerCLI
930911
cwarn << ":-( Not accepted.";
931912
f.rejectedSolution(false);
932913
}
914+
//exit(0);
933915
}
934916
else if (EthashAux::eval(previous.seedHash, previous.headerHash, solution.nonce).value < previous.boundary)
935917
{
@@ -942,6 +924,7 @@ class MinerCLI
942924
cwarn << ":-( Not accepted.";
943925
f.rejectedSolution(true);
944926
}
927+
//exit(0);
945928
}
946929
else {
947930
f.failedSolution();
@@ -1005,7 +988,7 @@ class MinerCLI
1005988

1006989
// this is very ugly, but if Stratum Client V2 tunrs out to be a success, V1 will be completely removed anyway
1007990
if (m_stratumClientVersion == 1) {
1008-
EthStratumClient client(&f, m_minerType, m_farmURL, m_port, m_user, m_pass, m_maxFarmRetries, m_worktimeout, m_ethereumStratum);
991+
EthStratumClient client(&f, m_minerType, m_farmURL, m_port, m_user, m_pass, m_maxFarmRetries, m_worktimeout, m_stratumProtocol, m_email);
1009992
if (m_farmFailOverURL != "")
1010993
{
1011994
if (m_fuser != "")
@@ -1045,7 +1028,7 @@ class MinerCLI
10451028
}
10461029
}
10471030
else if (m_stratumClientVersion == 2) {
1048-
EthStratumClientV2 client(&f, m_minerType, m_farmURL, m_port, m_user, m_pass, m_maxFarmRetries, m_worktimeout, m_ethereumStratum);
1031+
EthStratumClientV2 client(&f, m_minerType, m_farmURL, m_port, m_user, m_pass, m_maxFarmRetries, m_worktimeout, m_stratumProtocol, m_email);
10491032
if (m_farmFailOverURL != "")
10501033
{
10511034
if (m_fuser != "")
@@ -1135,12 +1118,13 @@ class MinerCLI
11351118

11361119
#if ETH_STRATUM || !ETH_TRUE
11371120
int m_stratumClientVersion = 1;
1138-
bool m_ethereumStratum = false;
1121+
int m_stratumProtocol = STRATUM_PROTOCOL_STRATUM;
11391122
string m_user;
11401123
string m_pass;
11411124
string m_port;
11421125
string m_fuser = "";
11431126
string m_fpass = "";
1127+
string m_email = "";
11441128
#endif
11451129
string m_fport = "";
11461130
};

libethcore/Miner.h

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
#define DAG_LOAD_MODE_SEQUENTIAL 1
4141
#define DAG_LOAD_MODE_SINGLE 2
4242

43+
#define STRATUM_PROTOCOL_STRATUM 0
44+
#define STRATUM_PROTOCOL_ETHPROXY 1
45+
#define STRATUM_PROTOCOL_ETHEREUMSTRATUM 2
4346

4447
using namespace std;
4548

0 commit comments

Comments
 (0)