pex: align max address thresholds (#8657)

This commit is contained in:
Callum Waters
2022-05-31 20:07:25 +02:00
committed by GitHub
parent a889f17e51
commit e8ac37223f
3 changed files with 3 additions and 9 deletions

View File

@@ -51,5 +51,5 @@ const (
// max addresses returned by GetSelection
// NOTE: this must match "maxMsgSize"
maxGetSelection = 250
maxGetSelection = 100
)

View File

@@ -102,12 +102,6 @@ type Reactor struct {
crawlPeerInfos map[types.NodeID]crawlPeerInfo
}
func (r *Reactor) minReceiveRequestInterval() time.Duration {
// NOTE: must be less than ensurePeersPeriod, otherwise we'll request
// peers too quickly from others and they'll think we're bad!
return r.ensurePeersPeriod / 3
}
// ReactorConfig holds reactor specific configuration data.
type ReactorConfig struct {
// Seed/Crawler mode
@@ -331,7 +325,7 @@ func (r *Reactor) receiveRequest(src Peer) error {
}
now := time.Now()
minInterval := r.minReceiveRequestInterval()
minInterval := minReceiveRequestInterval
if now.Sub(lastReceived) < minInterval {
return fmt.Errorf(
"peer (%v) sent next PEX request too soon. lastReceived: %v, now: %v, minInterval: %v. Disconnecting",

View File

@@ -24,7 +24,7 @@ var (
// See https://github.com/tendermint/tendermint/issues/6371
const (
// the minimum time one peer can send another request to the same peer
minReceiveRequestInterval = 100 * time.Millisecond
minReceiveRequestInterval = 200 * time.Millisecond
// the maximum amount of addresses that can be included in a response
maxAddresses uint16 = 100