Skip to content

Commit f330d86

Browse files
solo mining was broken
1 parent 79e40c9 commit f330d86

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

ethminer/FarmClient.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class FarmClient : public jsonrpc::Client
5353
) : jsonrpc::Client(conn, type)
5454
{
5555
m_opMode = _opMode;
56-
m_userAcct = ProgOpt::Get("0xBitcoin", "MinerAcct");
56+
userAcct = ProgOpt::Get("0xBitcoin", "MinerAcct");
5757
if (_opMode == OperationMode::Solo)
5858
{
5959
m_tokenContract = ProgOpt::Get("0xBitcoin", "TokenContract");
@@ -72,7 +72,7 @@ class FarmClient : public jsonrpc::Client
7272
Json::Value result;
7373
result = CallMethod("getChallengeNumber", data);
7474
_challenge = fromHex(result.asString());
75-
data.append(m_userAcct);
75+
data.append(userAcct);
7676
result = CallMethod("getMinimumShareTarget", data);
7777
m_target = u256(result.asString());
7878

@@ -96,7 +96,7 @@ class FarmClient : public jsonrpc::Client
9696
{
9797
// challenge
9898
Json::Value p;
99-
p["from"] = m_userAcct;
99+
p["from"] = userAcct;
100100
p["to"] = m_tokenContract;
101101

102102
h256 bMethod = sha3("getChallengeNumber()");
@@ -147,7 +147,7 @@ class FarmClient : public jsonrpc::Client
147147

148148
Json::Value data;
149149
data.append("0x" + _nonce.hex());
150-
data.append(devFeeMining ? DonationAddress : m_userAcct);
150+
data.append(devFeeMining ? DonationAddress : userAcct);
151151
data.append("0x" + toHex(_hash));
152152
Json::Value::UInt64 diff = static_cast<Json::Value::UInt64>(m_difficulty);
153153
data.append(diff);
@@ -196,12 +196,9 @@ class FarmClient : public jsonrpc::Client
196196
// prepare transaction
197197
Transaction t;
198198
if (m_lastSolution.elapsedSeconds() > 5 * 60 || m_txNonce == -1)
199-
{
200199
m_txNonce = getNextNonce();
201-
} else
202-
{
200+
else
203201
m_txNonce++;
204-
}
205202
m_lastSolution.restart();
206203
t.nonce = m_txNonce;
207204
t.receiveAddress = toAddress(m_tokenContract);
@@ -389,15 +386,15 @@ class FarmClient : public jsonrpc::Client
389386
int getNextNonce() {
390387
// get transaction count for nonce
391388
Json::Value p;
392-
p.append(m_userAcct);
389+
p.append(userAcct);
393390
p.append("latest");
394391
Json::Value result = CallMethod("eth_getTransactionCount", p);
395392
return HexToInt(result.asString());
396393
}
397394

398395
uint64_t tokenBalance() {
399396
Json::Value p;
400-
p["from"] = m_userAcct;
397+
p["from"] = userAcct;
401398
p["to"] = m_tokenContract;
402399

403400
h256 bMethod = sha3("balanceOf(address)");
@@ -406,7 +403,7 @@ class FarmClient : public jsonrpc::Client
406403

407404
// address
408405
stringstream ss;
409-
ss << std::setw(64) << std::setfill('0') << m_userAcct.substr(2);
406+
ss << std::setw(64) << std::setfill('0') << userAcct.substr(2);
410407
std::string s2(ss.str());
411408
sMethod = sMethod + s2;
412409
p["data"] = sMethod;
@@ -460,7 +457,7 @@ class FarmClient : public jsonrpc::Client
460457
u256 recommendation = 0;
461458
for (auto m : m_biddingMiners)
462459
{
463-
if (m.challenge == _challenge && stricmp(m.account.c_str(), m_userAcct.c_str()) != 0)
460+
if (m.challenge == _challenge && stricmp(m.account.c_str(), userAcct.c_str()) != 0)
464461
{
465462
LogF << "Trace: RecommendedGasPrice, existing bidder " << m.account.substr(0,10) << ", gasPrice=" << m.gasPrice;
466463
if (m.gasPrice > recommendation)
@@ -618,10 +615,10 @@ class FarmClient : public jsonrpc::Client
618615

619616
public:
620617
bool devFeeMining = false;
618+
string userAcct;
621619

622620
private:
623621
OperationMode m_opMode;
624-
string m_userAcct;
625622
string m_userAcctPK;
626623
string m_tokenContract;
627624
int m_txNonce = -1;

ethminer/MinerAux.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,8 @@ class MinerCLI
750750
nodeClient = new jsonrpc::HttpClient("https://mainnet.infura.io/J9KBwsJ0q1LMIQvzDlGC:8545");
751751
nodeRPC = new FarmClient(*nodeClient, OperationMode::Solo);
752752
}
753-
753+
else
754+
f.hashingAcct = workRPC.userAcct;
754755
h256 target;
755756
bytes challenge;
756757
deque<bytes> recentChallenges;

0 commit comments

Comments
 (0)