From 9badb310aed64d8c193359cc81988d6742acfc0a Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Wed, 15 Jun 2016 13:05:00 +0200 Subject: [PATCH] remove snappy_buffer_size constant in favor of max_compressed_len --- ethcore/src/snapshot/mod.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ethcore/src/snapshot/mod.rs b/ethcore/src/snapshot/mod.rs index 5d20c61b4..c70b92ffc 100644 --- a/ethcore/src/snapshot/mod.rs +++ b/ethcore/src/snapshot/mod.rs @@ -40,10 +40,6 @@ mod block; // Try to have chunks be around 16MB (before compression) const PREFERRED_CHUNK_SIZE: usize = 16 * 1024 * 1024; -// use initially 20MB for the reusable snappy buffers. -// should always be larger than PREFERRED_CHUNK_SIZE for fault tolerance. -const SNAPPY_BUFFER_SIZE: usize = 20 * 1024 * 1024; - // compresses the data into the buffer, resizing if necessary. fn compression_helper(input: &[u8], output: &mut Vec) -> usize { let max_size = snappy::max_compressed_len(input.len()); @@ -159,7 +155,7 @@ pub fn chunk_blocks(client: &BlockChainClient, best_block_hash: H256, genesis_ha rlps: VecDeque::new(), current_hash: best_block_hash, hashes: Vec::new(), - snappy_buffer: vec![0; SNAPPY_BUFFER_SIZE], + snappy_buffer: vec![0; snappy::max_compressed_len(PREFERRED_CHUNK_SIZE)], }; try!(chunker.chunk_all(genesis_hash, path)); @@ -229,7 +225,7 @@ pub fn chunk_state(db: &HashDB, root: &H256, path: &Path) -> Result, E rlps: Vec::new(), cur_size: 0, snapshot_path: path, - snappy_buffer: vec![0; SNAPPY_BUFFER_SIZE], + snappy_buffer: vec![0; snappy::max_compressed_len(PREFERRED_CHUNK_SIZE)], }; trace!(target: "snapshot", "beginning state chunking");