Browse Source

Parallelised uncle checking.

cl-refactor
Gav Wood 10 years ago
parent
commit
dd8bc4b78d
  1. 4
      ethminer/MinerAux.h
  2. 5
      libethcore/Common.h
  3. 4
      libethereum/BlockChain.cpp
  4. 3
      libethereum/BlockQueue.cpp
  5. 2
      libethereum/State.cpp

4
ethminer/MinerAux.h

@ -362,7 +362,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;
@ -378,7 +378,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 (...)
{

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());

Loading…
Cancel
Save