summaryrefslogtreecommitdiffhomepage
path: root/device
diff options
context:
space:
mode:
Diffstat (limited to 'device')
-rw-r--r--device/noise-protocol.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/device/noise-protocol.go b/device/noise-protocol.go
index dd75cc3..88c6aae 100644
--- a/device/noise-protocol.go
+++ b/device/noise-protocol.go
@@ -315,8 +315,13 @@ func (device *Device) ConsumeMessageInitiation(msg *MessageInitiation) *Peer {
handshake.chainKey = chainKey
handshake.remoteIndex = msg.Sender
handshake.remoteEphemeral = msg.Ephemeral
- handshake.lastTimestamp = timestamp
- handshake.lastInitiationConsumption = time.Now()
+ if timestamp.After(handshake.lastTimestamp) {
+ handshake.lastTimestamp = timestamp
+ }
+ now := time.Now()
+ if now.After(handshake.lastInitiationConsumption) {
+ handshake.lastInitiationConsumption = now
+ }
handshake.state = HandshakeInitiationConsumed
handshake.mutex.Unlock()