Skip to content

Commit

Permalink
working exit country selection wihtout fallback, introduces new struc…
Browse files Browse the repository at this point in the history
…ture db_countries and find_exit_location fn from GH-469
  • Loading branch information
czarte committed Nov 7, 2024
1 parent 5eff1d7 commit 9c0d116
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 51 deletions.
6 changes: 6 additions & 0 deletions node/src/neighborhood/gossip_acceptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ impl DebutHandler {
let mut debuting_node = NodeRecord::from(debuting_agr);
match user_exit_preferences_opt {
Some(user_exit_preferences) => {
//TODO 788 check if country code is present in Neighborhood DB and if yes, perform assign country code to exit_countries without duplication
user_exit_preferences.assign_nodes_country_undesirability(&mut debuting_node)
}
None => (),
Expand Down Expand Up @@ -894,6 +895,7 @@ impl IntroductionHandler {
let mut new_introducer = NodeRecord::from(introducer);
//TODO 468 add country undesirability
match user_exit_preferences_opt {
//TODO 788 check if country code is present in Neighborhood DB and if yes, perform assign country code to exit_countries without duplication
Some(user_exit_preferences) => user_exit_preferences
.assign_nodes_country_undesirability(&mut new_introducer),
None => (),
Expand Down Expand Up @@ -1148,6 +1150,7 @@ impl StandardGossipHandler {
// TODO modify for country undesirability in node_record (make it mut)
match user_exit_preferences_opt {
Some(user_exit_preferences) => {
//TODO 788 check if country code is present in Neighborhood DB and if yes, perform assign country code to exit_countries without duplication
user_exit_preferences.assign_nodes_country_undesirability(&mut node_record)
}
None => (),
Expand Down Expand Up @@ -2076,6 +2079,7 @@ mod tests {
country_codes: vec!["FR".to_string()],
priority: 2,
}]),
db_countries: vec!["FR".to_string()],
});

let qualifies_result = subject.qualifies(&dest_db, &agrs, gossip_source);
Expand Down Expand Up @@ -2472,6 +2476,7 @@ mod tests {
country_codes: vec!["FR".to_string()],
priority: 1,
}]),
db_countries: vec!["FR".to_string()],
});
neighborhood_metadata.cpm_recipient = cpm_recipient;
let system = System::new("test");
Expand Down Expand Up @@ -3069,6 +3074,7 @@ mod tests {
country_codes: vec!["CZ".to_string()],
priority: 1,
}]),
db_countries: vec!["CZ".to_string()],
});

let result = subject.handle(
Expand Down
Loading

0 comments on commit 9c0d116

Please sign in to comment.