Skip to content

Commit

Permalink
fix time check
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed Jul 8, 2024
1 parent 8e440cd commit 68a8f91
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mixing/mixpool/mixpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1395,8 +1395,9 @@ func (p *Pool) checkAcceptKE(ke *wire.MsgMixKeyExchange) error {
return ruleError(ErrPeerPositionOutOfBounds)
}

now := time.Now()
keEpoch := time.Unix(int64(ke.Epoch), 0)
if keEpoch.Add(earlyKEDuration).Before(time.Now()) {
if now.Before(keEpoch) && now.Sub(keEpoch) > earlyKEDuration {
err := fmt.Errorf("KE received too early for stated epoch")
return ruleError(err)
}
Expand Down

0 comments on commit 68a8f91

Please sign in to comment.