Skip to content
Snippets Groups Projects
Commit d0286c67 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Disable registration checks for expired identities

parent 475c5976
Branches
Tags
2 merge requests!23Release,!13Hotfix/no host cooldown + return sende2e TS
......@@ -77,7 +77,7 @@ func track(session *storage.Session, addrSpace *AddressSpace, ourId *id.ID, stop
// Generates the IDs since the last track
protoIds, err := ephemeral.GetIdsByRange(
ourId, uint(addressSize), lastCheck, lastCheck.Sub(now))
ourId, uint(addressSize), lastCheck, now.Sub(lastCheck))
jww.DEBUG.Printf("Now: %s, LastCheck: %s, Different: %s",
now, lastCheck, now.Sub(lastCheck))
......
......@@ -8,7 +8,7 @@ import (
"gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id/ephemeral"
"gitlab.com/xx_network/primitives/netTime"
// "gitlab.com/xx_network/primitives/netTime"
"strconv"
"time"
)
......@@ -29,13 +29,13 @@ func newRegistration(reg Identity, kv *versioned.KV) (*registration, error) {
reg.EndValid = reg.EndValid.Round(0)
reg.End = reg.End.Round(0)
now := netTime.Now()
// now := netTime.Now()
// Do edge checks to determine if the identity is valid
if now.After(reg.End) && reg.ExtraChecks < 1 {
return nil, errors.New("Cannot create a registration for an " +
"identity which has expired")
}
// if now.After(reg.End) && reg.ExtraChecks < 1 {
// return nil, errors.New("Cannot create a registration for an " +
// "identity which has expired")
// }
// Set the prefix
kv = kv.Prefix(regPrefix(reg.EphId, reg.Source, reg.StartValid))
......
......@@ -5,27 +5,27 @@ import (
"gitlab.com/elixxir/ekv"
"gitlab.com/xx_network/primitives/netTime"
"math/rand"
"strings"
// "strings"
"testing"
"time"
)
func TestNewRegistration_Failed(t *testing.T) {
// Generate an identity for use
rng := rand.New(rand.NewSource(42))
timestamp := time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)
idu, _ := generateFakeIdentity(rng, 15, timestamp)
id := idu.Identity
kv := versioned.NewKV(make(ekv.Memstore))
id.End = time.Time{}
id.ExtraChecks = 0
_, err := newRegistration(id, kv)
if err == nil || !strings.Contains(err.Error(), "Cannot create a registration for an identity which has expired") {
t.Error("Registration creation succeeded with expired identity.")
}
}
// func TestNewRegistration_Failed(t *testing.T) {
// // Generate an identity for use
// rng := rand.New(rand.NewSource(42))
// timestamp := time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)
// idu, _ := generateFakeIdentity(rng, 15, timestamp)
// id := idu.Identity
// kv := versioned.NewKV(make(ekv.Memstore))
// id.End = time.Time{}
// id.ExtraChecks = 0
// _, err := newRegistration(id, kv)
// if err == nil || !strings.Contains(err.Error(), "Cannot create a registration for an identity which has expired") {
// t.Error("Registration creation succeeded with expired identity.")
// }
// }
func TestNewRegistration_Ephemeral(t *testing.T) {
// Generate an identity for use
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment