Skip to content

Commit

Permalink
can't ban for this yet, but may want to eventually
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed Jul 8, 2024
1 parent 81f65e6 commit 5b53347
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 0 additions & 4 deletions mixing/mixpool/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ var (
// position of a peer's own PR is outside of the possible bounds of
// the previously seen messages.
ErrPeerPositionOutOfBounds = newBannableError("peer position cannot be a valid seen PRs index", 0)

// ErrEarlyKE is returned by AcceptMessage if a key exchange message
// with a stated epoch is sent too early for that epoch time.
ErrEarlyKE = newBannableError("KE received too early for stated epoch", 0)
)

// IsBannable returns whether the error condition is such that the peer with
Expand Down
5 changes: 3 additions & 2 deletions mixing/mixpool/mixpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1396,8 +1396,9 @@ func (p *Pool) checkAcceptKE(ke *wire.MsgMixKeyExchange) error {
}

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

return nil
Expand Down

0 comments on commit 5b53347

Please sign in to comment.