mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
experiment: reject bad peer info messages
This commit is contained in:
parent
83624369bf
commit
e26c40a6d9
@ -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")
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user