Skip to main content

MAX_PENDING_VERIFY

Constant MAX_PENDING_VERIFY 

Source
pub const MAX_PENDING_VERIFY: usize = 131_072;
Expand description

Global hard upper bound on the number of keys held in pending_verify.

Without a bound, a peer in the local routing table can flood NeighborSyncRequest messages (each capped only by MAX_REPLICATION_MESSAGE_SIZE ≈ 10 MiB, i.e. ~320k 32-byte hints per message) and grow this map without limit, exhausting node memory and driving a self-amplifying storm of outbound verification requests.

131_072 entries is far above any legitimate aggregate need while bounding worst-case memory to a few tens of MiB (each VerificationEntry is on the order of a few hundred bytes; its sub-collections are populated only from close-group-sized verification evidence, never from attacker hint volume).

The global cap is paired with elastic max-min sender accounting: one peer may borrow otherwise-unused capacity for a large bootstrap snapshot, but a later under-represented sender reclaims slots from an over-represented one. Verification service is round-robin across capacity owners, so arrival order cannot turn this memory circuit breaker into sender starvation.