Reduce maximum checkpoint size in the Zebra code

The new limits are 400 blocks and 32 MB.
This commit is contained in:
teor 2020-10-26 11:49:24 +10:00
parent 672b39a847
commit 20dfd04463
2 changed files with 12 additions and 5 deletions

View File

@ -79,7 +79,14 @@ pub const MAX_QUEUED_BLOCKS_PER_HEIGHT: usize = 4;
/// We limit the maximum number of blocks in each checkpoint. Each block uses a
/// constant amount of memory for the supporting data structures and futures.
pub const MAX_CHECKPOINT_HEIGHT_GAP: usize = 2_000;
///
/// We choose a checkpoint gap that allows us to verify one checkpoint for
/// every `ObtainTips` or `ExtendTips` response.
///
/// `zcashd`'s maximum `FindBlocks` response size is 500 hashes. `zebrad` uses
/// 1 hash to verify the tip, and discards 1-2 hashes to work around `zcashd`
/// bugs. So the most efficient gap is slightly less than 500 blocks.
pub const MAX_CHECKPOINT_HEIGHT_GAP: usize = 400;
/// A checkpointing block verifier.
///

View File

@ -25,10 +25,10 @@ use std::os::unix::process::ExitStatusExt;
mod args;
/// We limit the memory usage for each checkpoint, based on the cumulative size of
/// the serialized blocks in the chain. Deserialized blocks are larger, because
/// they contain pointers and non-compact integers. But they should be within a
/// constant factor of the serialized size.
const MAX_CHECKPOINT_BYTE_COUNT: u64 = 256 * 1024 * 1024;
/// the serialized blocks in the chain. Deserialized blocks are slightly larger
/// than serialized blocks, but they should be within a constant factor of the
/// serialized size.
const MAX_CHECKPOINT_BYTE_COUNT: u64 = 32 * 1024 * 1024;
/// Initialise tracing using its defaults.
fn init_tracing() {