From 39a52ae219dd1a3f94e8bc1e6a51b54913f2a1ca Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 23 Apr 2015 18:23:12 +0200 Subject: [PATCH] Fix killBlockchain. --- libethereum/Client.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index 675999a13..9c8905036 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -237,9 +237,6 @@ void Client::doneWorking() void Client::killChain() { - WriteGuard l(x_postMine); - WriteGuard l2(x_preMine); - bool wasMining = isMining(); if (wasMining) stopMining(); @@ -248,18 +245,21 @@ void Client::killChain() m_tq.clear(); m_bq.clear(); m_farm.stop(); - m_preMine = State(); - m_postMine = State(); -// ETH_WRITE_GUARDED(x_stateDB) // no point doing this yet since we can't control where else it's open yet. { + WriteGuard l(x_postMine); + WriteGuard l2(x_preMine); + + m_preMine = State(); + m_postMine = State(); + m_stateDB = OverlayDB(); m_stateDB = State::openDB(Defaults::dbPath(), WithExisting::Kill); - } - m_bc.reopen(Defaults::dbPath(), WithExisting::Kill); + m_bc.reopen(Defaults::dbPath(), WithExisting::Kill); - m_preMine = State(m_stateDB); - m_postMine = State(m_stateDB); + m_preMine = State(m_stateDB, BaseState::CanonGenesis); + m_postMine = State(m_stateDB); + } if (auto h = m_host.lock()) h->reset();