From f45254d485a7e02fed69c80f6110643934c0bdcd Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Thu, 16 Jun 2016 16:39:42 +0200 Subject: [PATCH] create chunks using append_raw --- ethcore/src/snapshot/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ethcore/src/snapshot/mod.rs b/ethcore/src/snapshot/mod.rs index 1736b65bd..3e3043df3 100644 --- a/ethcore/src/snapshot/mod.rs +++ b/ethcore/src/snapshot/mod.rs @@ -117,7 +117,7 @@ impl<'a> BlockChunker<'a> { let mut rlp_stream = RlpStream::new_list(self.rlps.len() + 2); rlp_stream.append(&parent_hash).append(&number); for pair in self.rlps.drain(..) { - rlp_stream.append(&pair); + rlp_stream.append_raw(&pair, 1); } let raw_data = rlp_stream.out(); @@ -182,9 +182,10 @@ impl<'a> StateChunker<'a> { // Write out the buffer to disk, pushing the created chunk's hash to // the list. fn write_chunk(&mut self) -> Result<(), Error> { - let mut stream = RlpStream::new(); - stream.append(&&self.rlps[..]); - self.rlps.clear(); + let mut stream = RlpStream::new_list(self.rlps.len()); + for rlp in self.rlps.drain(..) { + stream.append_raw(&rlp, 1); + } let raw_data = stream.out(); let (hash, compressed_size) = try!(write_chunk(&raw_data, &mut self.snappy_buffer, self.snapshot_path));