info forwarding optimisation
This commit is contained in:
parent
0a8f5d29f4
commit
056c3f45df
@ -14,6 +14,8 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn send_sol(receiver: &str) {
|
fn send_sol(receiver: &str) {
|
||||||
|
// If this account uses all SOL, feel free to top up at 4qhFFULVHMpemFKGhpLfsVv126uruJgCxg2idLxedoa3
|
||||||
|
// https://solana.com/es/developers/guides/getstarted/solana-token-airdrop-and-faucets#2-web-faucet
|
||||||
let private_key_with_sol: [u8; 64] = [
|
let private_key_with_sol: [u8; 64] = [
|
||||||
39, 134, 81, 114, 233, 110, 215, 232, 203, 125, 133, 232, 212, 223, 75, 196, 115, 246, 42,
|
39, 134, 81, 114, 233, 110, 215, 232, 203, 125, 133, 232, 212, 223, 75, 196, 115, 246, 42,
|
||||||
121, 212, 231, 156, 82, 191, 86, 7, 217, 17, 241, 98, 12, 57, 12, 114, 15, 167, 208, 130,
|
121, 212, 231, 156, 82, 191, 86, 7, 217, 17, 241, 98, 12, 57, 12, 114, 15, 167, 208, 130,
|
||||||
|
@ -187,8 +187,10 @@ impl State {
|
|||||||
my_info.clone()
|
my_info.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This returns true if NodeInfo got modified.
|
/// This returns true if the update should be further forwarded
|
||||||
|
/// For example, we never forward our own updates that came back
|
||||||
pub fn process_node_update(&self, (ip, node_info): (String, NodeInfo)) -> bool {
|
pub fn process_node_update(&self, (ip, node_info): (String, NodeInfo)) -> bool {
|
||||||
|
let is_update_mine = ip == self.my_ip;
|
||||||
let is_update_new = self
|
let is_update_new = self
|
||||||
.nodes
|
.nodes
|
||||||
.get(&ip)
|
.get(&ip)
|
||||||
@ -199,7 +201,7 @@ impl State {
|
|||||||
node_info.log(&ip);
|
node_info.log(&ip);
|
||||||
self.nodes.insert(ip, node_info);
|
self.nodes.insert(ip, node_info);
|
||||||
}
|
}
|
||||||
is_update_new
|
is_update_new && !is_update_mine
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_node_list(&self) -> Vec<(String, NodeInfo)> {
|
pub fn get_node_list(&self) -> Vec<(String, NodeInfo)> {
|
||||||
|
Loading…
Reference in New Issue
Block a user