Browse Source

Clear transaction hashes on chain reorg, too.

cl-refactor
Gav Wood 10 years ago
parent
commit
bc9b022d20
  1. 10
      libethereum/BlockChain.cpp

10
libethereum/BlockChain.cpp

@ -599,9 +599,13 @@ ImportRoute BlockChain::import(VerifiedBlockRef const& _block, OverlayDB const&
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)
m_blockHashes.erase(h256(u256(number(*i))));
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);
@ -636,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