From 9a8fdeead94a226af9f6dc306caa4077d126df45 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Sat, 23 Jul 2016 17:05:34 +0200 Subject: [PATCH] Enable WAL and disable DB repair (#1696) * Enable WAL * Disable rewind --- ethcore/src/blockchain/blockchain.rs | 6 +++++- ethcore/src/client/client.rs | 7 ++++++- util/src/kvdb.rs | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index ee92e5628..f7e0a29fa 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -297,6 +297,10 @@ impl BlockChain { let best_block_hash = match bc.extras_db.get(b"best").unwrap() { Some(best) => { let mut new_best = H256::from_slice(&best); + if !bc.blocks_db.get(&new_best).unwrap().is_some() { + warn!("Best block {} not found", new_best.hex()); + } + /* TODO: enable this once the best block issue is resolved while !bc.blocks_db.get(&new_best).unwrap().is_some() { match bc.rewind() { Some(h) => { @@ -308,7 +312,7 @@ impl BlockChain { } } info!("Restored mismatched best block. Was: {}, new: {}", H256::from_slice(&best).hex(), new_best.hex()); - } + }*/ new_best } None => { diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index e804cde57..b7e78edb1 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -198,10 +198,15 @@ impl Client { state_db.commit(0, &spec.genesis_header().hash(), None).expect("Error commiting genesis state to state DB"); } + if !chain.block_header(&chain.best_block_hash()).map_or(true, |h| state_db.contains(h.state_root())) { + warn!("State root not found for block #{} ({})", chain.best_block_number(), chain.best_block_hash().hex()); + } + + /* TODO: enable this once the best block issue is resolved while !chain.block_header(&chain.best_block_hash()).map_or(true, |h| state_db.contains(h.state_root())) { warn!("State root not found for block #{} ({}), recovering...", chain.best_block_number(), chain.best_block_hash().hex()); chain.rewind(); - } + }*/ let engine = Arc::new(spec.engine); diff --git a/util/src/kvdb.rs b/util/src/kvdb.rs index b4477e240..93dc760c4 100644 --- a/util/src/kvdb.rs +++ b/util/src/kvdb.rs @@ -168,8 +168,8 @@ impl Database { opts.set_block_based_table_factory(&block_opts); } - let mut write_opts = WriteOptions::new(); - write_opts.disable_wal(true); + let write_opts = WriteOptions::new(); + //write_opts.disable_wal(true); // TODO: make sure this is safe let db = match DB::open(&opts, path) { Ok(db) => db,