Merge branch 'develop' into neighbours

This commit is contained in:
subtly 2015-04-13 15:24:01 -04:00
commit 0a4e2329f0
3 changed files with 17 additions and 5 deletions

View File

@ -192,7 +192,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin)
state.sync(bc, txs, gp); state.sync(bc, txs, gp);
state.commitToMine(bc); state.commitToMine(bc);
MineInfo info; MineInfo info;
for (info.completed = false; !info.completed; info = state.mine()) {} ProofOfWork pow;
for (info.completed = false; !info.completed; info = state.mine(&pow)) {}
state.completeMine(); state.completeMine();
} }
catch (Exception const& _e) catch (Exception const& _e)
@ -577,7 +578,7 @@ void overwriteBlockHeader(BlockInfo& _currentBlockHeader, mObject& _blObj)
std::pair<MineInfo, Ethash::Proof> ret; std::pair<MineInfo, Ethash::Proof> ret;
while (!ProofOfWork::verify(_currentBlockHeader)) while (!ProofOfWork::verify(_currentBlockHeader))
{ {
ret = pow.mine(_currentBlockHeader, 1000, true, true); ret = pow.mine(_currentBlockHeader, 1000, true);
Ethash::assignResult(ret.second, _currentBlockHeader); Ethash::assignResult(ret.second, _currentBlockHeader);
} }
} }
@ -623,7 +624,7 @@ void updatePoW(BlockInfo& _bi)
std::pair<MineInfo, Ethash::Proof> ret; std::pair<MineInfo, Ethash::Proof> ret;
while (!ProofOfWork::verify(_bi)) while (!ProofOfWork::verify(_bi))
{ {
ret = pow.mine(_bi, 10000, true, true); ret = pow.mine(_bi, 10000, true);
Ethash::assignResult(ret.second, _bi); Ethash::assignResult(ret.second, _bi);
} }
_bi.noteDirty(); _bi.noteDirty();

View File

@ -68,7 +68,8 @@ BOOST_AUTO_TEST_CASE(Complex)
// Mine to get some ether! // Mine to get some ether!
s.commitToMine(bc); s.commitToMine(bc);
while (!s.mine(100, true).completed) {} ProofOfWork pow;
while (!s.mine(&pow).completed) {}
s.completeMine(); s.completeMine();
bc.attemptImport(s.blockData(), stateDB); bc.attemptImport(s.blockData(), stateDB);
@ -88,7 +89,7 @@ BOOST_AUTO_TEST_CASE(Complex)
// Mine to get some ether and set in stone. // Mine to get some ether and set in stone.
s.commitToMine(bc); s.commitToMine(bc);
s.commitToMine(bc); s.commitToMine(bc);
while (!s.mine(100, true).completed) {} while (!s.mine(&pow).completed) {}
s.completeMine(); s.completeMine();
bc.attemptImport(s.blockData(), stateDB); bc.attemptImport(s.blockData(), stateDB);

View File

@ -72,6 +72,16 @@ class WebThreeStubClient : public jsonrpc::Client
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
std::string eth_hashrate() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->CallMethod("eth_hashrate",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string eth_coinbase() throw (jsonrpc::JsonRpcException) std::string eth_coinbase() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;