mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 16:24:45 +00:00
Refactor peer management into two distinct phases: PeerConnection (handshake phase): - Indexed by LinkId (identity unknown for inbound connections) - HandshakeState: AwaitingHello → SentHello → SentAuth → AwaitingAuthAck → Complete - Tracks expected identity, retry count, timing ActivePeer (authenticated phase): - Indexed by NodeId (verified identity) - ConnectivityState: Connected → Stale → Reconnecting → Disconnected - Holds tree state, bloom filter, routing data Cross-connection handling: - Deterministic tie-breaker: smaller node_id's OUTBOUND wins - PromotionResult enum for promotion outcomes - Both nodes reach same conclusion independently Node refactoring: - Split storage: connections (by LinkId) + peers (by NodeId) - Add addr_to_link reverse lookup for packet dispatch - promote_connection() handles promotion with cross-connection detection