diff --git a/zebra-consensus/src/checkpoint.rs b/zebra-consensus/src/checkpoint.rs index 99120912..bcb93a98 100644 --- a/zebra-consensus/src/checkpoint.rs +++ b/zebra-consensus/src/checkpoint.rs @@ -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. /// diff --git a/zebra-utils/src/bin/zebra-checkpoints/main.rs b/zebra-utils/src/bin/zebra-checkpoints/main.rs index 90ba5e17..406a3619 100644 --- a/zebra-utils/src/bin/zebra-checkpoints/main.rs +++ b/zebra-utils/src/bin/zebra-checkpoints/main.rs @@ -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() {