Skip to content

Commit 5fb2abe

Browse files
committed
verify node instance before accepting
1 parent 02b0a11 commit 5fb2abe

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

gossip/src/cluster_info.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,10 +2507,8 @@ impl ClusterInfo {
25072507
};
25082508
let mut verify_node_instance = |value: &CrdsValue| {
25092509
if self.verify_node_instance(value) {
2510-
info!("greg: node instance verify good");
25112510
true
25122511
} else {
2513-
info!("greg: node instance verify bad");
25142512
self.stats.num_unverifed_node_instances.add_relaxed(1);
25152513
false
25162514
}
@@ -2595,16 +2593,13 @@ impl ClusterInfo {
25952593
CrdsData::NodeInstance(node) => node.from(),
25962594
_ => return true, // If not a NodeInstance, nothing to verify.
25972595
};
2598-
match self.lookup_contact_info(pubkey, |ci| ci.clone()) {
2599-
Some(_) => {
2600-
info!("greg: got contact info for pk: {pubkey:?}");
2601-
true
2602-
},
2603-
None => {
2604-
info!("greg: no contact info for pk: {pubkey:?}");
2605-
false // Need to receive contact info first
2606-
}
2596+
// if contact info for the pubkey exists in the crds table, then the
2597+
// the contact info has already been verified. Therefore, the node
2598+
// instance is valid.
2599+
if self.lookup_contact_info(pubkey, |ci| ci.clone()).is_some() {
2600+
return true;
26072601
}
2602+
false
26082603
}
26092604

26102605
// Consumes packets received from the socket, deserializing, sanitizing and

0 commit comments

Comments
 (0)