From 99fb135b5b32fa4d00c370b8247b7037c97d0ece Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 7 Dec 2023 10:28:26 -0500 Subject: [PATCH] fix invalid nodeinfo check --- veilid-core/src/routing_table/bucket_entry.rs | 5 +++++ veilid-core/src/routing_table/routing_table_inner.rs | 5 ++++- veilid-core/src/storage_manager/mod.rs | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/veilid-core/src/routing_table/bucket_entry.rs b/veilid-core/src/routing_table/bucket_entry.rs index 28a666c6..eba6a8cf 100644 --- a/veilid-core/src/routing_table/bucket_entry.rs +++ b/veilid-core/src/routing_table/bucket_entry.rs @@ -647,6 +647,11 @@ impl BucketEntryInner { return false; } + // If we have had any lost answers recently, this is not reliable + if self.peer_stats.rpc_stats.recent_lost_answers > 0 { + return false; + } + match self.peer_stats.rpc_stats.first_consecutive_seen_ts { // If we have not seen seen a node consecutively, it can't be reliable None => false, diff --git a/veilid-core/src/routing_table/routing_table_inner.rs b/veilid-core/src/routing_table/routing_table_inner.rs index 855e1321..1af08ccf 100644 --- a/veilid-core/src/routing_table/routing_table_inner.rs +++ b/veilid-core/src/routing_table/routing_table_inner.rs @@ -962,7 +962,10 @@ impl RoutingTableInner { None => has_valid_own_node_info, Some(entry) => entry.with_inner(|e| { e.signed_node_info(routing_domain) - .map(|sni| sni.has_any_signature()) + .map(|sni| { + sni.has_any_signature() + && !matches!(sni.node_info().network_class(), NetworkClass::Invalid) + }) .unwrap_or(false) }), } diff --git a/veilid-core/src/storage_manager/mod.rs b/veilid-core/src/storage_manager/mod.rs index 25d2b858..4abe128d 100644 --- a/veilid-core/src/storage_manager/mod.rs +++ b/veilid-core/src/storage_manager/mod.rs @@ -723,14 +723,14 @@ impl StorageManager { let dest = rpc_processor .resolve_target_to_destination( - vc.target, + vc.target.clone(), SafetySelection::Unsafe(Sequencing::NoPreference), ) .await .map_err(VeilidAPIError::from)?; network_result_value_or_log!(rpc_processor - .rpc_call_value_changed(dest, vc.key, vc.subkeys, vc.count, (*vc.value).clone()) + .rpc_call_value_changed(dest, vc.key, vc.subkeys.clone(), vc.count, (*vc.value).clone()) .await .map_err(VeilidAPIError::from)? => [format!(": dest={:?} vc={:?}", dest, vc)] { });