mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 21:05:20 +00:00
Fix timestamp bug causing peer discovery failures
- Fixed BitchatPacket convenience initializer to use milliseconds (was using seconds) - Fixed BitchatMessage binary encoding to use milliseconds for consistency - Updated decoding logic to properly handle millisecond timestamps - This resolves the issue where packets were being dropped due to timestamp validation failures All timestamps are now consistently in milliseconds throughout the codebase.
This commit is contained in:
@@ -1053,7 +1053,7 @@ class BluetoothMeshService: NSObject {
|
||||
let currentTime = UInt64(Date().timeIntervalSince1970 * 1000) // milliseconds
|
||||
let timeDiff = abs(Int64(currentTime) - Int64(packet.timestamp))
|
||||
if timeDiff > 300000 { // 5 minutes in milliseconds
|
||||
print("[SECURITY] Dropping packet with timestamp too far from current time: \(timeDiff/1000) seconds")
|
||||
print("[SECURITY] Dropping packet from \(peerID) type:\(packet.type) - timestamp diff: \(timeDiff/1000)s (packet:\(packet.timestamp) vs current:\(currentTime))")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user