Browse Source

clear reverted block hashes from cache during imporing

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
a72b51c86d
  1. 17
      libethereum/BlockChain.cpp

17
libethereum/BlockChain.cpp

@ -597,10 +597,27 @@ ImportRoute BlockChain::import(VerifiedBlockRef const& _block, OverlayDB const&
// Most of the time these two will be equal - only when we're doing a chain revert will they not be
if (common != last)
{
// If we are reverting previous blocks, we need to clear their blooms (in particular, to
// rebuild any higher level blooms that they contributed to).
clearBlockBlooms(number(common) + 1, number(last) + 1);
// clear reverted blockhashes
DEV_WRITE_GUARDED(x_blockHashes)
for (auto i = route.begin(); i != route.end() && *i != common; ++i)
{
BlockInfo tbi = BlockInfo(block(*i));
auto h = h256(tbi.number);
for (auto j = m_blockHashes.begin(); j != m_blockHashes.end();)
{
if (j->first == h)
j = m_blockHashes.erase(j);
else
++j;
}
}
}
// Go through ret backwards until hash != last.parent and update m_transactionAddresses, m_blockHashes
for (auto i = route.rbegin(); i != route.rend() && *i != common; ++i)
{

Loading…
Cancel
Save