@@ -45,7 +45,7 @@ class FarmClient : public jsonrpc::Client
45
45
46
46
// Constructor
47
47
FarmClient (
48
- jsonrpc::IClientConnector &conn,
48
+ jsonrpc::IClientConnector &conn,
49
49
OperationMode _opMode,
50
50
std::string _userAcct,
51
51
jsonrpc::clientVersion_t type = jsonrpc::JSONRPC_CLIENT_V2
@@ -96,8 +96,8 @@ class FarmClient : public jsonrpc::Client
96
96
_target = m_target;
97
97
_difficulty = m_difficulty;
98
98
_hashingAcct = m_hashingAcct;
99
- LogF << " Trace: getWorkPool - challenge:" << toHex (_challenge).substr (0 , 8 )
100
- << " , target:" << std::hex << std::setw (16 ) << std::setfill (' 0' ) << upper64OfHash (_target)
99
+ LogF << " Trace: getWorkPool - challenge:" << toHex (_challenge).substr (0 , 8 )
100
+ << " , target:" << std::hex << std::setw (16 ) << std::setfill (' 0' ) << upper64OfHash (_target)
101
101
<< " , difficulty:" << std::dec << _difficulty;
102
102
}
103
103
@@ -134,8 +134,8 @@ class FarmClient : public jsonrpc::Client
134
134
{
135
135
// challenge
136
136
Json::Value p;
137
- p[" from" ] = m_userAcct;
138
- p[" to" ] = m_tokenContract;
137
+ p[" from" ] = m_userAcct;
138
+ p[" to" ] = m_tokenContract;
139
139
140
140
h256 bMethod = sha3 (" getChallengeNumber()" );
141
141
std::string sMethod = toHex (bMethod, dev::HexPrefix::Add);
@@ -166,7 +166,7 @@ class FarmClient : public jsonrpc::Client
166
166
if (result.isString ())
167
167
{
168
168
_target = h256 (result.asString ());
169
- }
169
+ }
170
170
else
171
171
throw jsonrpc::JsonRpcException (jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString ());
172
172
@@ -235,8 +235,8 @@ class FarmClient : public jsonrpc::Client
235
235
m_lastSolution.restart ();
236
236
t.nonce = m_txNonce;
237
237
t.receiveAddress = toAddress (m_tokenContract);
238
- t.gas = u256 (200000 );
239
238
ProgOpt::Reload ();
239
+ t.gas = atoi (ProgOpt::Get (" 0xBitcoin" , " GasLimit" ).c_str ());
240
240
m_startGas = atoi (ProgOpt::Get (" 0xBitcoin" , " GasPrice" ).c_str ());
241
241
m_maxGas = atoi (ProgOpt::Get (" 0xBitcoin" , " MaxGasPrice" ).c_str ());
242
242
t.gasPrice = RecommendedGasPrice (_challenge);
@@ -272,7 +272,7 @@ class FarmClient : public jsonrpc::Client
272
272
}
273
273
274
274
// this routine runs on a separate thread
275
- void txpoolScanner ()
275
+ void txpoolScanner ()
276
276
{
277
277
Json::Value data;
278
278
Json::Value result;
@@ -363,7 +363,7 @@ class FarmClient : public jsonrpc::Client
363
363
}
364
364
365
365
// we've only got the hashes at this point, so now retrieve each tx
366
- for (uint32_t i = 0 ; i < result.size (); i++)
366
+ for (uint32_t i = 0 ; i < result.size (); i++)
367
367
{
368
368
string hash = result[i].asString ();
369
369
data.clear ();
@@ -395,7 +395,7 @@ class FarmClient : public jsonrpc::Client
395
395
}
396
396
}
397
397
}
398
- LogD << " Miner " << miner.account .substr (0 , 10 ) << " submitted tx " << miner.txHash .substr (0 , 10 )
398
+ LogD << " Miner " << miner.account .substr (0 , 10 ) << " submitted tx " << miner.txHash .substr (0 , 10 )
399
399
<< " . gasPrice=" << miner.gasPrice << " , challenge=" << toHex (miner.challenge ).substr (0 , 8 );
400
400
m_biddingMiners.push_back (miner);
401
401
}
@@ -427,8 +427,8 @@ class FarmClient : public jsonrpc::Client
427
427
428
428
uint64_t tokenBalance () {
429
429
Json::Value p;
430
- p[" from" ] = m_userAcct;
431
- p[" to" ] = m_tokenContract;
430
+ p[" from" ] = m_userAcct;
431
+ p[" to" ] = m_tokenContract;
432
432
433
433
h256 bMethod = sha3 (" balanceOf(address)" );
434
434
std::string sMethod = toHex (bMethod, dev::HexPrefix::Add);
@@ -530,22 +530,22 @@ class FarmClient : public jsonrpc::Client
530
530
{
531
531
needsDeleting.push_back (t.challenge );
532
532
LogB << " Tx " << t.txHash .substr (0 , 10 ) << " failed, gasPrice = " << t.gasPrice / 1000000000 << " :(" ;
533
- }
533
+ }
534
534
else if (status == Waiting)
535
535
{
536
536
// adjust gas price if necessary
537
537
u256 recommended = RecommendedGasPrice (t.challenge );
538
538
if (t.gasPrice < recommended)
539
539
{
540
540
// increase gas price and resend
541
- // but first make a copy of existing tx. we can't be sure if the old one will get replaced
541
+ // but first make a copy of existing tx. we can't be sure if the old one will get replaced
542
542
// by the new one, before one or the other gets mined.
543
543
t.gasPrice = recommended;
544
544
txSignSend (t);
545
545
m_pendingTxs.push_back (t);
546
546
LogB << " Adjusting gas price to " << t.gasPrice / 1000000000 << " , new tx hash=" << t.txHash ;
547
547
}
548
- }
548
+ }
549
549
}
550
550
551
551
for (auto challenge : needsDeleting)
@@ -566,7 +566,7 @@ class FarmClient : public jsonrpc::Client
566
566
ss = std::stringstream ();
567
567
ss << " 0x" << toHex (t.rlp ());
568
568
569
- // submit to the node
569
+ // submit to the node
570
570
Json::Value p;
571
571
p.append (ss.str ());
572
572
Json::Value result = CallMethod (" eth_sendRawTransaction" , p);
@@ -579,7 +579,7 @@ class FarmClient : public jsonrpc::Client
579
579
std::vector<byte> mix (84 );
580
580
std::ostringstream ss;
581
581
Json::Value p;
582
- p[" from" ] = _sender;
582
+ p[" from" ] = _sender;
583
583
p[" to" ] = m_tokenContract; // 0xbitcoin contract address
584
584
585
585
// function signature
0 commit comments