diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index de42c2a72..6e9e04e85 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -760,6 +760,8 @@ impl BlockChainClient for Client where V: Verifier { let best_header_bytes = self.best_block_header(); let best_header = HeaderView::new(&best_header_bytes); + trace!(target: "pv64_snapshot", "Taking snapshot starting at block {}", best_header.number()); + let mut manifest_hashes = Vec::new(); // lock the state db while we create the state chunks. @@ -774,7 +776,7 @@ impl BlockChainClient for Client where V: Verifier { let mut path = root_dir.to_owned(); path.push("snapshot/"); - ::std::fs::create_dir(&path).unwrap(); + let _ = ::std::fs::create_dir(&path); let block_chunk_hashes = BlockChunker::new(self, best_hash, genesis_hash).chunk_all(&path); for hash in block_chunk_hashes { diff --git a/ethcore/src/pv64/mod.rs b/ethcore/src/pv64/mod.rs index 39b46eda7..848364d9d 100644 --- a/ethcore/src/pv64/mod.rs +++ b/ethcore/src/pv64/mod.rs @@ -60,6 +60,7 @@ impl<'a> BlockChunker<'a> { // This will return true if it created a block chunk, false otherwise. fn fill_buffers(&mut self) -> bool { let mut loaded_size = 0; + let mut blocks_loaded = 0; while loaded_size < PREFERRED_CHUNK_SIZE && self.current_hash != self.genesis_hash { @@ -80,9 +81,14 @@ impl<'a> BlockChunker<'a> { self.current_hash = BlockView::new(&block).header_view().parent_hash(); self.rlps.push_front((block, receipts)); + blocks_loaded += 1; } - loaded_size == 0 + if blocks_loaded > 0 { + trace!(target: "pv64_snapshot", "prepared block chunk with {} blocks", blocks_loaded); + } + + loaded_size != 0 } // write out the data in the buffers to a chunk on disk @@ -96,6 +102,8 @@ impl<'a> BlockChunker<'a> { let raw_data = rlp_stream.out(); let hash = raw_data.sha3(); + trace!(target: "pv64_snapshot", "writing block chunk. hash: {}, size: {} bytes", hash.hex(), raw_data.len()); + let mut file_path = path.to_owned(); file_path.push(hash.hex());