Skip to content

Commit

Permalink
backout: compare unix times
Browse files Browse the repository at this point in the history
this check is incorrect
  • Loading branch information
jrick committed Jul 8, 2024
1 parent 666a2cb commit 97ddd8c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mixing/mixpool/mixpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

const minconf = 1
const feeRate = 0.0001e8
const earlyKESecs = 5
const earlyKEDuration = 5 * time.Second

type idPubKey = [33]byte

Expand Down Expand Up @@ -1395,8 +1395,9 @@ func (p *Pool) checkAcceptKE(ke *wire.MsgMixKeyExchange) error {
return ruleError(ErrPeerPositionOutOfBounds)
}

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

0 comments on commit 97ddd8c

Please sign in to comment.