pub const MAX_QUEUED_BLOCKS_PER_HEIGHT: usize = 4;
Expand description

The maximum number of queued blocks at any one height.

This value is a tradeoff between:

  • rejecting bad blocks: if we queue more blocks, we need fewer network retries, but use a bit more CPU when verifying,
  • avoiding a memory DoS: if we queue fewer blocks, we use less memory.

Memory usage is controlled by the sync service, because it controls block downloads. When the verifier services process blocks, they reduce memory usage by committing blocks to the disk state. (Or dropping invalid blocks.)