mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 08:14:42 +00:00
Fix identity cache miss during lookup response verification
Guard discovery triggers in handle_path_broken() and handle_coords_required() with has_cached_identity() check. When the XK responder receives an error signal before msg3 completes, the initiator's identity is unknown, making LookupResponse proof verification impossible. Skip discovery in this case — the handshake retry mechanism handles recovery. Downgrade the identity_cache miss log from ERROR to WARN since it's a known race condition, not a bug.
This commit is contained in:
@@ -963,6 +963,13 @@ impl Node {
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if a node's identity is in the cache (without LRU touch).
|
||||
pub(crate) fn has_cached_identity(&self, addr: &NodeAddr) -> bool {
|
||||
let mut prefix = [0u8; 15];
|
||||
prefix.copy_from_slice(&addr.as_bytes()[0..15]);
|
||||
self.identity_cache.contains_key(&prefix)
|
||||
}
|
||||
|
||||
/// Number of identity cache entries.
|
||||
pub fn identity_cache_len(&self) -> usize {
|
||||
self.identity_cache.len()
|
||||
|
||||
Reference in New Issue
Block a user