fix signing and validation

add timestamp to signed node info
This commit is contained in:
John Smith
2022-05-11 09:37:54 -04:00
parent 912869d329
commit d7ba221b48
7 changed files with 51 additions and 4 deletions

View File

@@ -487,6 +487,16 @@ impl RoutingTable {
node_id: DHTKey,
signed_node_info: SignedNodeInfo,
) -> Result<NodeRef, String> {
// validate signed node info is not something malicious
if node_id == self.node_id() {
return Err("can't register own node id in routing table".to_owned());
}
if let Some(rpi) = &signed_node_info.node_info.relay_peer_info {
if rpi.node_id.key == node_id {
return Err("node can not be its own relay".to_owned());
}
}
let nr = self.create_node_ref(node_id, |e| {
e.update_node_info(signed_node_info);
})?;