diff --git a/streamer/src/nonblocking/quic.rs b/streamer/src/nonblocking/quic.rs index 0c278ea818e814..4d57c5e3d11629 100644 --- a/streamer/src/nonblocking/quic.rs +++ b/streamer/src/nonblocking/quic.rs @@ -495,6 +495,16 @@ async fn setup_connection( stats.clone(), ), |(pubkey, stake, total_stake, max_stake, min_stake)| { + // The heuristic is that the stake should be large engouh to have 1 stream pass throuh within one throttle + // interval during which we allow max MAX_STREAMS_PER_100MS streams. + let min_stake_ratio = 1_f64 / MAX_STREAMS_PER_100MS as f64; + let stake_ratio = stake as f64 / total_stake as f64; + let stake = if stake_ratio < min_stake_ratio { + // If it is a staked connection with ultra low stake ratio, treat it as unstaked. + 0 + } else { + stake + }; NewConnectionHandlerParams { packet_sender, remote_pubkey: Some(pubkey),