Skip to content

Commit

Permalink
mixpool: Reject KEs submitted too early
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed Jul 8, 2024
1 parent 02a286d commit f278df3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mixing/mixpool/mixpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

const minconf = 1
const feeRate = 0.0001e8
const clientTimeoutDuration = 30 * time.Second

type idPubKey = [33]byte

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

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

return nil
}

Expand Down

0 comments on commit f278df3

Please sign in to comment.