experiment: reject bad peer info messages

This commit is contained in:
Cassandra Heart 2025-12-20 07:44:40 -06:00
parent 83624369bf
commit e26c40a6d9
No known key found for this signature in database
GPG Key ID: 371083BFA6C240AA
2 changed files with 4 additions and 4 deletions

View File

@ -476,7 +476,7 @@ func (e *AppConsensusEngine) validatePeerInfoMessage(
zap.Int64("peer_timestamp", peerInfo.Timestamp),
zap.Int64("cutoff", oneMinuteAgo),
)
return p2p.ValidationResultIgnore
return p2p.ValidationResultReject
}
if peerInfo.Timestamp > fiveMinutesLater {
@ -501,7 +501,7 @@ func (e *AppConsensusEngine) validatePeerInfoMessage(
now := time.Now().UnixMilli()
if int64(keyRegistry.LastUpdated) < now-1000 {
e.logger.Debug("key registry timestamp too old")
return p2p.ValidationResultIgnore
return p2p.ValidationResultReject
}
if int64(keyRegistry.LastUpdated) > now+5000 {
e.logger.Debug("key registry timestamp too far in future")

View File

@ -523,7 +523,7 @@ func (e *GlobalConsensusEngine) validatePeerInfoMessage(
e.logger.Debug("peer info timestamp too old",
zap.Int64("peer_timestamp", peerInfo.Timestamp),
)
return tp2p.ValidationResultIgnore
return tp2p.ValidationResultReject
}
if peerInfo.Timestamp > now+5000 {
@ -549,7 +549,7 @@ func (e *GlobalConsensusEngine) validatePeerInfoMessage(
if int64(keyRegistry.LastUpdated) < now-1000 {
e.logger.Debug("key registry timestamp too old")
return tp2p.ValidationResultIgnore
return tp2p.ValidationResultReject
}
if int64(keyRegistry.LastUpdated) > now+5000 {