From 4375b34a89d0a0d0494a17610e047fb8262e9dc7 Mon Sep 17 00:00:00 2001 From: josh <josh@elixxir.io> Date: Wed, 12 May 2021 15:28:43 -0700 Subject: [PATCH] Remove GetRegistrationTimestampNano API call in storage/user --- network/node/register.go | 2 +- storage/user/registation.go | 7 ------- storage/user/registation_test.go | 4 ++-- ud/register.go | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/network/node/register.go b/network/node/register.go index aa80a5c5d..82ab2cc3d 100644 --- a/network/node/register.go +++ b/network/node/register.go @@ -60,7 +60,7 @@ func registerNodes(sender *gateway.Sender, session *storage.Session, rngGen *fas u := session.User() regSignature := u.GetTransmissionRegistrationValidationSignature() // Timestamp in which user has registered with permissioning - regTimestamp := u.GetRegistrationTimestampNano() + regTimestamp := u.GetRegistrationTimestamp().UnixNano() uci := u.GetCryptographicIdentity() cmix := session.Cmix() diff --git a/storage/user/registation.go b/storage/user/registation.go index 491380221..cfc32f1b8 100644 --- a/storage/user/registation.go +++ b/storage/user/registation.go @@ -36,13 +36,6 @@ func (u *User) GetReceptionRegistrationValidationSignature() []byte { return u.receptionRegValidationSig } -// Returns the registration timestamp stored in RAM as int64 -func (u *User) GetRegistrationTimestampNano() int64 { - u.rvsMux.RLock() - defer u.rvsMux.RUnlock() - return u.registrationTimestamp.UnixNano() -} - // Returns the registration timestamp stored in RAM as func (u *User) GetRegistrationTimestamp() time.Time { u.rvsMux.RLock() diff --git a/storage/user/registation_test.go b/storage/user/registation_test.go index 0011f9e7b..43dd65241 100644 --- a/storage/user/registation_test.go +++ b/storage/user/registation_test.go @@ -176,9 +176,9 @@ func TestUser_GetRegistrationTimestamp(t *testing.T) { "\n\tExpected: %d\n\tReceieved: %d", testTime.UnixNano(), unixNano) } - if testTime.UnixNano() != u.GetRegistrationTimestampNano() { + if testTime.UnixNano() != u.GetRegistrationTimestamp().UnixNano() { t.Errorf("Timestamp from GetRegistrationTimestampNano was not expected."+ - "\n\tExpected: %d\n\tReceieved: %d", testTime.UnixNano(), u.GetRegistrationTimestampNano()) + "\n\tExpected: %d\n\tReceieved: %d", testTime.UnixNano(), u.GetRegistrationTimestamp().UnixNano()) } if !testTime.Equal(u.GetRegistrationTimestamp()) { diff --git a/ud/register.go b/ud/register.go index dfb6da246..c2dd6a0ad 100644 --- a/ud/register.go +++ b/ud/register.go @@ -49,7 +49,7 @@ func (m *Manager) register(username string, comm registerUserComms) error { Salt: cryptoUser.GetReceptionSalt(), }, UID: cryptoUser.GetReceptionID().Marshal(), - Timestamp: user.GetRegistrationTimestampNano(), + Timestamp: user.GetRegistrationTimestamp().UnixNano(), } // Sign the identity data and add to user registration message -- GitLab