create chunks using append_raw
This commit is contained in:
parent
ce87691a2e
commit
f45254d485
@ -117,7 +117,7 @@ impl<'a> BlockChunker<'a> {
|
|||||||
let mut rlp_stream = RlpStream::new_list(self.rlps.len() + 2);
|
let mut rlp_stream = RlpStream::new_list(self.rlps.len() + 2);
|
||||||
rlp_stream.append(&parent_hash).append(&number);
|
rlp_stream.append(&parent_hash).append(&number);
|
||||||
for pair in self.rlps.drain(..) {
|
for pair in self.rlps.drain(..) {
|
||||||
rlp_stream.append(&pair);
|
rlp_stream.append_raw(&pair, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
let raw_data = rlp_stream.out();
|
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
|
// Write out the buffer to disk, pushing the created chunk's hash to
|
||||||
// the list.
|
// the list.
|
||||||
fn write_chunk(&mut self) -> Result<(), Error> {
|
fn write_chunk(&mut self) -> Result<(), Error> {
|
||||||
let mut stream = RlpStream::new();
|
let mut stream = RlpStream::new_list(self.rlps.len());
|
||||||
stream.append(&&self.rlps[..]);
|
for rlp in self.rlps.drain(..) {
|
||||||
self.rlps.clear();
|
stream.append_raw(&rlp, 1);
|
||||||
|
}
|
||||||
|
|
||||||
let raw_data = stream.out();
|
let raw_data = stream.out();
|
||||||
let (hash, compressed_size) = try!(write_chunk(&raw_data, &mut self.snappy_buffer, self.snapshot_path));
|
let (hash, compressed_size) = try!(write_chunk(&raw_data, &mut self.snappy_buffer, self.snapshot_path));
|
||||||
|
Loading…
Reference in New Issue
Block a user