Browse Source

Merge branch 'develop' of https://github.com/ethereum/cpp-ethereum into client_ref

Conflicts:
	libethereum/BlockChain.cpp
cl-refactor
Marek Kotewicz 10 years ago
parent
commit
0e7f4b3759
  1. 25
      libethereum/BlockChain.cpp

25
libethereum/BlockChain.cpp

@ -598,24 +598,17 @@ 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)
{
// Erase the number-lookup cache for the segment of the chain that we're reverting (if any).
unsigned n = number(route.front());
DEV_WRITE_GUARDED(x_blockHashes)
for (auto i = route.begin(); i != route.end() && *i != common; ++i, --n)
m_blockHashes.erase(h256(u256(n)));
DEV_WRITE_GUARDED(x_transactionAddresses)
m_transactionAddresses.clear(); // TODO: could perhaps delete them individually?
// 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
@ -647,7 +640,7 @@ ImportRoute BlockChain::import(VerifiedBlockRef const& _block, OverlayDB const&
}
}
// Collate transaction hashes and remember who they were.
h256s newTransactionAddresses;
//h256s newTransactionAddresses;
{
bytes blockBytes;
RLP blockRLP(*i == _block.info.hash() ? _block.block : &(blockBytes = block(*i)));

Loading…
Cancel
Save