Browse Source

Merge remote-tracking branch 'up/develop' into bugFix

cl-refactor
yann300 10 years ago
parent
commit
49d69ee32a
  1. 4
      ethminer/MinerAux.h
  2. 5
      libethcore/Common.h
  3. 4
      libethereum/BlockChain.cpp
  4. 3
      libethereum/BlockQueue.cpp
  5. 5
      libethereum/Client.cpp
  6. 2
      libethereum/State.cpp
  7. 14
      libweb3jsonrpc/WebThreeStubServerBase.cpp

4
ethminer/MinerAux.h

@ -363,7 +363,7 @@ private:
cout << "inner mean: " << innerMean << " H/s" << endl;
(void)_phoneHome;
#if ETH_JSONRPC || !ETH_TRUE
#if ETH_JSONRPC || !ETH_TRUE
if (_phoneHome)
{
cout << "Phoning home to find world ranking..." << endl;
@ -379,7 +379,7 @@ private:
cout << "Error phoning home. ET is sad." << endl;
}
}
#endif
#endif
exit(0);
}

5
libethcore/Common.h

@ -100,9 +100,10 @@ struct ImportRequirements
using value = unsigned;
enum
{
ValidNonce = 1, ///< Validate Nonce
ValidNonce = 1, ///< Validate nonce
DontHave = 2, ///< Avoid old blocks
Default = ValidNonce | DontHave
CheckUncles = 4, ///< Check uncle nonces
Default = ValidNonce | DontHave | CheckUncles
};
};

4
libethereum/BlockChain.cpp

@ -317,8 +317,8 @@ tuple<h256s, h256s, bool> BlockChain::sync(BlockQueue& _bq, OverlayDB const& _st
{
try
{
// Nonce is already verified thread at this point.
auto r = import(block.first, block.second, _stateDB, ImportRequirements::Default & ~ImportRequirements::ValidNonce);
// Nonce & uncle nonces already verified thread at this point.
auto r = import(block.first, block.second, _stateDB, ImportRequirements::Default & ~ImportRequirements::ValidNonce & ~ImportRequirements::CheckUncles);
fresh += r.first;
dead += r.second;
}

3
libethereum/BlockQueue.cpp

@ -78,6 +78,9 @@ void BlockQueue::verifierBody()
try {
res.first.populate(res.second, CheckEverything, work.first);
res.first.verifyInternals(&res.second);
RLP r(&res.second);
for (auto const& uncle: r[2])
BlockInfo().populateFromHeader(RLP(uncle.data()), CheckEverything);
}
catch (...)
{

5
libethereum/Client.cpp

@ -484,7 +484,7 @@ void Client::syncBlockQueue()
cwork << "BQ ==> CHAIN ==> STATE";
{
tie(ir.first, ir.second, m_syncBlockQueue) = m_bc.sync(m_bq, m_stateDB, 100);
tie(ir.first, ir.second, m_syncBlockQueue) = m_bc.sync(m_bq, m_stateDB, 10);
if (ir.first.empty())
return;
}
@ -606,9 +606,10 @@ bool Client::remoteActive() const
void Client::onPostStateChanged()
{
cnote << "Post state changed: Restarting mining...";
cnote << "Post state changed";
if (isMining() || remoteActive())
{
cnote << "Restarting mining...";
DEV_WRITE_GUARDED(x_working)
m_working.commitToMine(m_bc);
DEV_READ_GUARDED(x_working)

2
libethereum/State.cpp

@ -667,7 +667,7 @@ u256 State::enact(bytesConstRef _block, BlockChain const& _bc, ImportRequirement
BOOST_THROW_EXCEPTION(UncleInChain() << errinfo_comment("Uncle in block already mentioned") << errinfo_data(toString(excluded)) << errinfo_hash256(sha3(i.data())));
excluded.insert(h);
BlockInfo uncle = BlockInfo::fromHeader(i.data(), CheckEverything, h);
BlockInfo uncle = BlockInfo::fromHeader(i.data(), (_ir & ImportRequirements::CheckUncles) ? CheckEverything : IgnoreNonce, h);
BlockInfo uncleParent(_bc.block(uncle.parentHash));
if ((bigint)uncleParent.number < (bigint)m_currentBlock.number - 7)
BOOST_THROW_EXCEPTION(UncleTooOld());

14
libweb3jsonrpc/WebThreeStubServerBase.cpp

@ -99,11 +99,12 @@ static Json::Value toJson(dev::eth::Transaction const& _t, std::pair<h256, unsig
return res;
}
static Json::Value toJson(dev::eth::BlockInfo const& _bi, UncleHashes const& _us, Transactions const& _ts)
static Json::Value toJson(dev::eth::BlockInfo const& _bi, BlockDetails const& _bd, UncleHashes const& _us, Transactions const& _ts)
{
Json::Value res = toJson(_bi);
if (_bi)
{
res["totalDifficulty"] = toJS(_bd.totalDifficulty);
res["uncles"] = Json::Value(Json::arrayValue);
for (h256 h: _us)
res["uncles"].append(toJS(h));
@ -114,11 +115,12 @@ static Json::Value toJson(dev::eth::BlockInfo const& _bi, UncleHashes const& _us
return res;
}
static Json::Value toJson(dev::eth::BlockInfo const& _bi, UncleHashes const& _us, TransactionHashes const& _ts)
static Json::Value toJson(dev::eth::BlockInfo const& _bi, BlockDetails const& _bd, UncleHashes const& _us, TransactionHashes const& _ts)
{
Json::Value res = toJson(_bi);
if (_bi)
{
res["totalDifficulty"] = toJS(_bd.totalDifficulty);
res["uncles"] = Json::Value(Json::arrayValue);
for (h256 h: _us)
res["uncles"].append(toJS(h));
@ -602,9 +604,9 @@ Json::Value WebThreeStubServerBase::eth_getBlockByHash(string const& _blockHash,
{
auto h = jsToFixed<32>(_blockHash);
if (_includeTransactions)
return toJson(client()->blockInfo(h), client()->uncleHashes(h), client()->transactions(h));
return toJson(client()->blockInfo(h), client()->blockDetails(h), client()->uncleHashes(h), client()->transactions(h));
else
return toJson(client()->blockInfo(h), client()->uncleHashes(h), client()->transactionHashes(h));
return toJson(client()->blockInfo(h), client()->blockDetails(h), client()->uncleHashes(h), client()->transactionHashes(h));
}
catch (...)
{
@ -618,9 +620,9 @@ Json::Value WebThreeStubServerBase::eth_getBlockByNumber(string const& _blockNum
{
auto h = jsToBlockNumber(_blockNumber);
if (_includeTransactions)
return toJson(client()->blockInfo(h), client()->uncleHashes(h), client()->transactions(h));
return toJson(client()->blockInfo(h), client()->blockDetails(h), client()->uncleHashes(h), client()->transactions(h));
else
return toJson(client()->blockInfo(h), client()->uncleHashes(h), client()->transactionHashes(h));
return toJson(client()->blockInfo(h), client()->blockDetails(h), client()->uncleHashes(h), client()->transactionHashes(h));
}
catch (...)
{

Loading…
Cancel
Save