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

Commit 419a515

Browse files
committedDec 5, 2018
Simplify hashrate submission
1 parent ccaae7f commit 419a515

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed
 

‎libpoolprotocols/PoolManager.cpp

+7-13
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,11 @@ void PoolManager::stop()
247247
DEV_BUILD_LOG_PROGRAMFLOW(cnote, "PoolManager::stop() end");
248248
}
249249

250-
void PoolManager::addConnection(URI& conn)
250+
void PoolManager::addConnection(URI& _conn)
251251
{
252-
Guard l(m_activeConnectionMutex);
253-
m_connections.push_back(conn);
252+
// Guard l(m_activeConnectionMutex);
253+
string con = _conn.str();
254+
m_connections.push_back(URI(con));
254255
}
255256

256257
/*
@@ -483,17 +484,10 @@ void PoolManager::submithrtimer_elapsed(const boost::system::error_code& ec)
483484
{
484485
if (m_running.load(std::memory_order_relaxed))
485486
{
487+
std::string hr_hex = toHex((uint64_t)Farm::f().HashRate(), HexPrefix::Add);
488+
486489
if (p_client && p_client->isConnected())
487-
{
488-
std::string h = toHex(toCompactBigEndian(uint64_t(Farm::f().HashRate()), 1));
489-
std::string res = h[0] != '0' ? h : h.substr(1);
490-
491-
// Should be 32 bytes
492-
// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submithashrate
493-
std::ostringstream ss;
494-
ss << "0x" << std::setw(64) << std::setfill('0') << res;
495-
p_client->submitHashrate(ss.str(), m_hashrateId);
496-
}
490+
p_client->submitHashrate(hr_hex, m_hashrateId);
497491

498492
// Resubmit actor
499493
m_submithrtimer.expires_from_now(boost::posix_time::seconds(m_hrReportingInterval));

0 commit comments

Comments
 (0)
This repository has been archived.