Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed Jul 8, 2024
1 parent 5b53347 commit 8e440cd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mixing/mixpool/mixpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ func (p *Pool) checkAcceptKE(ke *wire.MsgMixKeyExchange) error {
}

keEpoch := time.Unix(int64(ke.Epoch), 0)
if time.Now().Add(-earlyKEDuration).Before(keEpoch) {
if keEpoch.Add(earlyKEDuration).Before(time.Now()) {
err := fmt.Errorf("KE received too early for stated epoch")
return ruleError(err)
}
Expand Down
3 changes: 2 additions & 1 deletion mixing/mixpool/mixpool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"math/big"
"os"
"testing"
"time"

"decred.org/cspp/v2/solverrpc"
"github.com/davecgh/go-spew/spew"
Expand Down Expand Up @@ -255,7 +256,7 @@ func TestAccept(t *testing.T) {

var (
seenPRs = []chainhash.Hash{pr.Hash()}
epoch uint64 = 0
epoch uint64 = uint64(time.Now().Unix())
sid [32]byte = mixing.SortPRsForSession([]*wire.MsgMixPairReq{pr}, epoch)
run uint32 = 0
pos uint32 = 0
Expand Down
3 changes: 2 additions & 1 deletion mixing/mixpool/orphans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"errors"
"reflect"
"testing"
"time"

"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/chaincfg/v3"
Expand Down Expand Up @@ -65,7 +66,7 @@ func TestOrphans(t *testing.T) {
pr.WriteHash(h)

prs := []*wire.MsgMixPairReq{pr}
epoch := uint64(1704067200)
epoch := uint64(time.Now().Unix())
sid := mixing.SortPRsForSession(prs, epoch)
ke := &wire.MsgMixKeyExchange{
Identity: id,
Expand Down

0 comments on commit 8e440cd

Please sign in to comment.