Skip to main content

SURPLUS_LOSS_TOLERANCE_DIVISOR

Constant SURPLUS_LOSS_TOLERANCE_DIVISOR 

Source
pub(crate) const SURPLUS_LOSS_TOLERANCE_DIVISOR: u8 = 4;
Expand description

Share loss a polynomial’s surplus is sized to absorb, as a reciprocal: 1/5 is 20 %.

The surplus is insurance against lost shares, and this is the loss rate it covers. A polynomial reconstructs from the first threshold distinct shares to arrive out of threshold + surplus emitted, so surviving a per-packet loss rate of p needs surplus >= threshold · p/(1−p) — which makes the surplus inherently a ratio of the threshold, and surplus/(threshold + surplus) the loss rate it tolerates.

At threshold/4 that is 20 %, and default_surplus_for rounds up so it is a floor rather than an approximation — see there for why the direction matters.