Skip to content

Commit

Permalink
fixing more Em comments
Browse files Browse the repository at this point in the history
  • Loading branch information
veorq committed Nov 18, 2019
1 parent 76a9f2f commit f1e81d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,11 @@ func (c *client) setTopicKey(key, topicHash []byte) error {
if ok {
// Only do key transition if the key received is distinct from the current one
if !bytes.Equal(topicKey, key) {
hashHash := e4crypto.HashTopic(string(topicHash))
hashOfHash := e4crypto.HashTopic(string(topicHash))
timestamp := make([]byte, e4crypto.TimestampLen)
binary.LittleEndian.PutUint64(timestamp, uint64(time.Now().Unix()))
topicKey = append(topicKey, timestamp...)
c.TopicKeys[hex.EncodeToString(hashHash)] = topicKey
c.TopicKeys[hex.EncodeToString(hashOfHash)] = topicKey
}
}

Expand All @@ -443,8 +443,8 @@ func (c *client) removeTopic(topicHash []byte) error {
delete(c.TopicKeys, hex.EncodeToString(topicHash))

// Delete key kept for key transition, if any
hashHash := e4crypto.HashTopic(string(topicHash))
delete(c.TopicKeys, hex.EncodeToString(hashHash))
hashOfHash := e4crypto.HashTopic(string(topicHash))
delete(c.TopicKeys, hex.EncodeToString(hashOfHash))

return c.save()
}
Expand Down
4 changes: 2 additions & 2 deletions crypto/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func ValidateTimestamp(timestamp []byte) error {
return ErrTimestampInFuture
}

leastValidTime := now.Add(time.Duration(-MaxDelayDuration))
leastValidTime := now.Add(-MaxDelayDuration)
if leastValidTime.After(tsTime) {
return ErrTimestampTooOld
}
Expand All @@ -160,7 +160,7 @@ func ValidateTimestampKey(timestamp []byte) error {
return ErrTimestampInFuture
}

leastValidTime := now.Add(time.Duration(-MaxDelayDuration))
leastValidTime := now.Add(-MaxDelayKeyTransition)
if leastValidTime.After(tsTime) {
return ErrTimestampTooOld
}
Expand Down

0 comments on commit f1e81d0

Please sign in to comment.