zebra_node_services/constants.rs
1//! Constants shared by some Zebra node services.
2
3/// We limit the maximum number of blocks in each checkpoint. Each block uses a
4/// constant amount of memory for the supporting data structures and futures.
5///
6/// We choose a checkpoint gap that allows us to verify one checkpoint for
7/// every `ObtainTips` or `ExtendTips` response.
8///
9/// `zcashd`'s maximum `FindBlocks` response size is 500 hashes. `zebrad` uses
10/// 1 hash to verify the tip, and discards 1-2 hashes to work around `zcashd`
11/// bugs. So the most efficient gap is slightly less than 500 blocks.
12pub const MAX_CHECKPOINT_HEIGHT_GAP: usize = 400;
13
14/// We limit the memory usage and download contention for each checkpoint,
15/// based on the cumulative size of the serialized blocks in the chain.
16///
17/// Deserialized blocks (in memory) are slightly larger than serialized blocks
18/// (on the network or disk). But they should be within a constant factor of the
19/// serialized size.
20pub const MAX_CHECKPOINT_BYTE_COUNT: u64 = 32 * 1024 * 1024;