Skip to content
This repository was archived by the owner on Apr 24, 2022. It is now read-only.

Commit a6fc7cc

Browse files
committedMay 4, 2018
Merge remote-tracking branch 'origin/release/0.14'
# Conflicts: # .bumpversion.cfg # CMakeLists.txt
2 parents a8f1c22 + d190f23 commit a6fc7cc

File tree

4 files changed

+51
-31
lines changed

4 files changed

+51
-31
lines changed
 

‎ethminer/MinerAux.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -775,12 +775,14 @@ class MinerCLI
775775
<< " -SE, --stratum-email <s> Email address used in eth-proxy (optional)" << endl
776776
<< " --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
777777
<< " -P URL Specify a pool URL. Can be used multiple times. The 1st for for the primary pool, and the 2nd for the failover pool." << endl
778-
<< " URL takes the form: scheme://user[:password]@hostname:port." << endl
778+
<< " URL takes the form: scheme://user[:password]@hostname:port[/emailaddress]." << endl
779779
<< " for getwork use one of the following schemes:" << endl
780780
<< " " << URI::KnownSchemes(ProtocolFamily::GETWORK) << endl
781781
<< " for stratum use one of the following schemes: "<< endl
782782
<< " " << URI::KnownSchemes(ProtocolFamily::STRATUM) << endl
783-
<< " Example: stratum+ssl://0x012345678901234567890234567890123.miner1@ethermine.org:5555" << endl
783+
<< " Example 1 : stratum+ssl://0x012345678901234567890234567890123.miner1@ethermine.org:5555" << endl
784+
<< " Example 2 : stratum1+tcp://0x012345678901234567890234567890123.miner1@nanopool.org:9999/john.doe@gmail.com" << endl
785+
<< " Example 3 : stratum1+tcp://0x012345678901234567890234567890123@nanopool.org:9999/miner1/john.doe@gmail.com" << endl
784786
<< endl
785787
<< "Benchmarking mode:" << endl
786788
<< " -M [<n>],--benchmark [<n>] Benchmark for mining and exit; Optionally specify block number to benchmark against specific DAG." << endl

‎libethcore/Farm.h

+2-5
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,15 @@ class Farm: public FarmFace
192192
p.ms = std::chrono::duration_cast<std::chrono::milliseconds>(now - m_lastStart).count();
193193
m_lastStart = now;
194194

195-
// Collect
195+
// Collect & Reset
196196
for (auto const& i : m_miners)
197197
{
198198
uint64_t minerHashCount = i->hashCount();
199+
i->resetHashCount();
199200
p.hashes += minerHashCount;
200201
p.minersHashes.push_back(minerHashCount);
201202
}
202203

203-
// Reset
204-
for (auto const& i : m_miners)
205-
i->resetHashCount();
206-
207204
if (p.hashes > 0)
208205
m_lastProgresses.push_back(p);
209206

‎libpoolprotocols/PoolManager.cpp

+21-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static string diffToDisplay(double diff)
1515
diff = diff / 1000.0;
1616
}
1717
stringstream ss;
18-
ss << fixed << setprecision(4) << diff << ' ' << k[i];
18+
ss << fixed << setprecision(2) << diff << ' ' << k[i];
1919
return ss.str();
2020
}
2121

@@ -89,14 +89,28 @@ PoolManager::PoolManager(PoolClient * client, Farm &farm, MinerType const & mine
8989

9090
m_farm.onSolutionFound([&](Solution sol)
9191
{
92-
m_submit_time = std::chrono::steady_clock::now();
92+
// Solution should passthrough only if client is
93+
// properly connected. Otherwise we'll have the bad behavior
94+
// to log nonce submission but receive no response
9395

94-
if (sol.stale)
95-
cnote << string(EthYellow "Stale nonce 0x") + toHex(sol.nonce);
96-
else
97-
cnote << string("Nonce 0x") + toHex(sol.nonce);
96+
if (p_client->isConnected()) {
97+
98+
m_submit_time = std::chrono::steady_clock::now();
99+
100+
if (sol.stale)
101+
cnote << string(EthYellow "Stale nonce 0x") + toHex(sol.nonce);
102+
else
103+
cnote << string("Nonce 0x") + toHex(sol.nonce);
104+
105+
p_client->submitSolution(sol);
106+
107+
}
108+
else {
109+
110+
cnote << string(EthRed "Nonce 0x") + toHex(sol.nonce) << "wasted. Waiting for connection ...";
111+
112+
}
98113

99-
p_client->submitSolution(sol);
100114
return false;
101115
});
102116
m_farm.onMinerRestart([&]() {

‎libpoolprotocols/stratum/EthStratumClient.cpp

+24-17
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,13 @@ void EthStratumClient::disconnect()
210210
m_subscribed.store(false, std::memory_order_relaxed);
211211
m_authorized.store(false, std::memory_order_relaxed);
212212

213-
if (m_onDisconnected) { m_onDisconnected(); }
214-
215213
// Release locking flag and set connection status
216214
m_connected.store(false, std::memory_order_relaxed);
217215
m_disconnecting.store(false, std::memory_order::memory_order_relaxed);
216+
217+
// Trigger handlers
218+
if (m_onDisconnected) { m_onDisconnected(); }
219+
218220
}
219221

220222
void EthStratumClient::resolve_handler(const boost::system::error_code& ec, tcp::resolver::iterator i)
@@ -367,13 +369,17 @@ void EthStratumClient::connect_handler(const boost::system::error_code& ec, tcp:
367369
jReq["params"] = Json::Value(Json::arrayValue);
368370

369371
p = m_conn.User().find_first_of(".");
370-
user = m_conn.User().substr(0, p);
371-
if (p + 1 <= m_conn.User().length())
372-
m_worker = m_conn.User().substr(p + 1);
373-
else
374-
// Some marketing ?
375-
m_worker = "ethminer " + std::string(ethminer_get_buildinfo()->project_version);
372+
if (p != string::npos) {
376373

374+
user = m_conn.User().substr(0, p);
375+
if (p + 1 <= m_conn.User().length())
376+
m_worker = m_conn.User().substr(p + 1);
377+
else
378+
m_worker.clear();
379+
380+
}
381+
382+
377383
switch (m_conn.Version()) {
378384

379385
case EthStratumClient::STRATUM:
@@ -386,8 +392,8 @@ void EthStratumClient::connect_handler(const boost::system::error_code& ec, tcp:
386392

387393

388394
jReq["method"] = "eth_submitLogin";
389-
jReq["worker"] = m_worker;
390-
jReq["params"].append(user);
395+
if (m_worker.length()) jReq["worker"] = m_worker;
396+
jReq["params"].append(m_conn.User() + m_conn.Path());
391397
if (!m_email.empty()) jReq["params"].append(m_email);
392398

393399
break;
@@ -627,9 +633,10 @@ void EthStratumClient::processReponse(Json::Value& responseObject)
627633
jReq["jsonrpc"] = "2.0";
628634
jReq["method"] = "mining.authorize";
629635
jReq["params"] = Json::Value(Json::arrayValue);
630-
jReq["params"].append(m_conn.User());
636+
jReq["params"].append(m_conn.User() + m_conn.Path());
631637
jReq["params"].append(m_conn.Pass());
632638

639+
633640
}
634641

635642
break;
@@ -687,7 +694,7 @@ void EthStratumClient::processReponse(Json::Value& responseObject)
687694
// Eventually request authorization
688695
jReq["id"] = unsigned(3);
689696
jReq["method"] = "mining.authorize";
690-
jReq["params"].append(m_conn.User());
697+
jReq["params"].append(m_conn.User() + m_conn.Path());
691698
jReq["params"].append(m_conn.Pass());
692699

693700
}
@@ -769,15 +776,15 @@ void EthStratumClient::processReponse(Json::Value& responseObject)
769776

770777
if (!_isSuccess) {
771778

772-
if (!m_authorized && !m_subscribed) {
779+
if (!m_subscribed) {
773780

774781
// Subscription pending
775782
cnote << "Subscription failed:" << _errReason;
776783
disconnect();
777784
return;
778785

779786
}
780-
else if (m_authorized && !m_subscribed) {
787+
else if (m_subscribed && !m_authorized) {
781788

782789
// Authorization pending
783790
cnote << "Worker not authorized:" << _errReason;
@@ -991,7 +998,7 @@ void EthStratumClient::submitHashrate(string const & rate) {
991998
Json::Value jReq;
992999
jReq["id"] = unsigned(9);
9931000
jReq["jsonrpc"] = "2.0";
994-
jReq["worker"] = m_worker;
1001+
if (m_worker.length()) jReq["worker"] = m_worker;
9951002
jReq["method"] = "eth_submitHashrate";
9961003
jReq["params"] = Json::Value(Json::arrayValue);
9971004
jReq["params"].append(m_rate);
@@ -1025,7 +1032,7 @@ void EthStratumClient::submitSolution(Solution solution) {
10251032
jReq["params"].append("0x" + nonceHex);
10261033
jReq["params"].append("0x" + solution.work.header.hex());
10271034
jReq["params"].append("0x" + solution.mixHash.hex());
1028-
jReq["worker"] = m_worker;
1035+
if (m_worker.length()) jReq["worker"] = m_worker;
10291036

10301037
break;
10311038

@@ -1035,7 +1042,7 @@ void EthStratumClient::submitSolution(Solution solution) {
10351042
jReq["params"].append("0x" + nonceHex);
10361043
jReq["params"].append("0x" + solution.work.header.hex());
10371044
jReq["params"].append("0x" + solution.mixHash.hex());
1038-
jReq["worker"] = m_worker;
1045+
if (m_worker.length()) jReq["worker"] = m_worker;
10391046

10401047
break;
10411048

0 commit comments

Comments
 (0)
This repository has been archived.