mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 01:45:20 +00:00
## Summary - Added timestamps to SecureLogger for precise timing analysis - Implemented NoiseHandshakeCoordinator to prevent race conditions - Added deterministic role selection based on peer ID comparison - Implemented proper handshake state machine with retry logic - Added duplicate message detection for handshake messages - Improved logging and diagnostics for handshake debugging ## Details The coordinator ensures only one peer initiates handshakes by using deterministic role selection (lower peer ID initiates). This prevents the simultaneous handshake attempts that were causing failures. The state machine tracks handshake progress and handles retries with exponential backoff. ## Testing Successfully builds with no errors or warnings. The implementation should resolve the "establishing encryption" stuck state issue by ensuring proper handshake coordination between peers.