aboutsummaryrefslogtreecommitdiff
path: root/pkg/instance/instance.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@mullvad.net>2021-12-05 00:58:32 +0100
committerRasmus Dahlberg <rasmus@mullvad.net>2021-12-05 00:58:32 +0100
commitba2219bb41ceb0b3b1fbdfe54ac580a476fbffa5 (patch)
tree5d2da4f78d95583b11f8b07d61aa69d10aebddfd /pkg/instance/instance.go
parent4daeaf52984d33c4ee1a213ce7eb7da191fb1d46 (diff)
implemented open-ended shard interval
Diffstat (limited to 'pkg/instance/instance.go')
-rw-r--r--pkg/instance/instance.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go
index dc7f5c5..bda553d 100644
--- a/pkg/instance/instance.go
+++ b/pkg/instance/instance.go
@@ -24,7 +24,6 @@ type Config struct {
Deadline time.Duration // Deadline used for gRPC requests
Interval time.Duration // Cosigning frequency
ShardStart uint64 // Shard interval start (num seconds since UNIX epoch)
- ShardEnd uint64 // Shard interval end (num seconds since UNIX epoch)
// Witnesses map trusted witness identifiers to public verification keys
Witnesses map[[types.HashSize]byte][types.VerificationKeySize]byte
@@ -109,11 +108,12 @@ func (i *Instance) leafRequestFromHTTP(ctx context.Context, r *http.Request) (*t
if !ed25519.Verify(vk, msg, sig) {
return nil, fmt.Errorf("invalid signature")
}
+ shardEnd := uint64(time.Now().Unix())
if req.ShardHint < i.ShardStart {
- return nil, fmt.Errorf("invalid shard hint: %d not in [%d, %d]", req.ShardHint, i.ShardStart, i.ShardEnd)
+ return nil, fmt.Errorf("invalid shard hint: %d not in [%d, %d]", req.ShardHint, i.ShardStart, shardEnd)
}
- if req.ShardHint > i.ShardEnd {
- return nil, fmt.Errorf("invalid shard hint: %d not in [%d, %d]", req.ShardHint, i.ShardStart, i.ShardEnd)
+ if req.ShardHint > shardEnd {
+ return nil, fmt.Errorf("invalid shard hint: %d not in [%d, %d]", req.ShardHint, i.ShardStart, shardEnd)
}
if err := i.DNS.Verify(ctx, req.DomainHint, req.VerificationKey); err != nil {
return nil, fmt.Errorf("invalid domain hint: %v", err)