From f400da405a726a09f98849ae0737eed89b98aa52 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Mon, 13 Jun 2016 13:52:41 +0200 Subject: [PATCH] state chunk creation tracing --- ethcore/src/client/client.rs | 2 -- ethcore/src/pv64/mod.rs | 9 +++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 012d0caad..61909f498 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -771,8 +771,6 @@ impl BlockChainClient for Client where V: Verifier { // lock the state db while we create the state chunks. let state_hashes = { let state_db = self.state_db.lock().unwrap(); - // todo [rob] actually create the state chunks. - StateChunker::chunk_all(state_db.as_hashdb(), &state_root, &path).unwrap() }; diff --git a/ethcore/src/pv64/mod.rs b/ethcore/src/pv64/mod.rs index d4cdb2323..358ce97ae 100644 --- a/ethcore/src/pv64/mod.rs +++ b/ethcore/src/pv64/mod.rs @@ -157,6 +157,8 @@ impl<'a> StateChunker<'a> { // Write out the buffer to disk, pushing the created chunk's hash to // the list. fn write_chunk(&mut self) { + trace!(target: "pv64_snapshot", "writing state chunk. uncompressed size: {}", self.cur_size); + let bytes = { let mut stream = RlpStream::new(); stream.append(&&self.rlps[..]); @@ -180,10 +182,8 @@ impl<'a> StateChunker<'a> { /// Walk the given state database starting from the given root, /// creating chunks and writing them out. /// - /// Returns a list of hashes created, or any error it may + /// Returns a list of hashes of chunks created, or any error it may /// have encountered. - /// - /// The data in the chunks is just a list of key, value pairs. pub fn chunk_all(db: &'a HashDB, root: &'a H256, path: &'a Path) -> Result, Error> { let account_view = try!(TrieDB::new(db, &root)); @@ -194,12 +194,13 @@ impl<'a> StateChunker<'a> { snapshot_path: path, }; + trace!(target: "pv64_snapshot", "beginning state chunking"); + // account_key here is the address' hash. for (account_key, account_data) in account_view.iter() { let account = AccountReader::from_thin_rlp(account_data); let fat_rlp = try!(account.to_fat_rlp(db)); - chunker.push(account_key, fat_rlp); }