fix signed node info

This commit is contained in:
John Smith 2022-11-04 12:58:13 -04:00
parent 9f917af767
commit 60c4648530
2 changed files with 17 additions and 14 deletions

View File

@ -181,20 +181,23 @@ impl BucketEntryInner {
// See if we have an existing signed_node_info to update or not // See if we have an existing signed_node_info to update or not
if let Some(current_sni) = opt_current_sni { if let Some(current_sni) = opt_current_sni {
// If the timestamp hasn't changed or is less, ignore this update // Always allow overwriting invalid/unsigned node
if signed_node_info.timestamp <= current_sni.timestamp { if current_sni.has_valid_signature() {
// If we received a node update with the same timestamp // If the timestamp hasn't changed or is less, ignore this update
// we can make this node live again, but only if our network has recently changed if signed_node_info.timestamp <= current_sni.timestamp {
// which may make nodes that were unreachable now reachable with the same dialinfo // If we received a node update with the same timestamp
if !self.updated_since_last_network_change // we can make this node live again, but only if our network has recently changed
&& signed_node_info.timestamp == current_sni.timestamp // which may make nodes that were unreachable now reachable with the same dialinfo
{ if !self.updated_since_last_network_change
// No need to update the signednodeinfo though since the timestamp is the same && signed_node_info.timestamp == current_sni.timestamp
// Touch the node and let it try to live again {
self.updated_since_last_network_change = true; // No need to update the signednodeinfo though since the timestamp is the same
self.touch_last_seen(intf::get_timestamp()); // Touch the node and let it try to live again
self.updated_since_last_network_change = true;
self.touch_last_seen(intf::get_timestamp());
}
return;
} }
return;
} }
} }

View File

@ -149,7 +149,6 @@ impl RPCProcessor {
) )
} }
} }
opt_sender_info = Some(sender_info.clone());
} }
SendDataKind::Indirect => { SendDataKind::Indirect => {
// Do nothing in this case, as the socket address returned here would be for any node other than ours // Do nothing in this case, as the socket address returned here would be for any node other than ours
@ -158,6 +157,7 @@ impl RPCProcessor {
// Do nothing in this case, as an existing connection could not have a different public address or it would have been reset // Do nothing in this case, as an existing connection could not have a different public address or it would have been reset
} }
}; };
opt_sender_info = Some(sender_info.clone());
} }
} }
} }