Skip to content

Commit

Permalink
ValidatorNetwork: use correct validator_id when fetching peer ids fro…
Browse files Browse the repository at this point in the history
…m the contact book
  • Loading branch information
styppo authored and nibhar committed Nov 25, 2024
1 parent 5d3c5e4 commit 10e9372
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions validator-network/src/network_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,23 +370,19 @@ where
}

// Try all validator peer_ids from our peer contact book.
let our_address = {
let own_validator_id = self.own_validator_id.read();
let Some(own_validator_id) = *own_validator_id else {
return Err(UnknownValidator(validator_id));
};
let validator_address = {
let validators = self.validators.read();
let Some(validators) = validators.as_ref() else {
return Err(UnknownValidator(validator_id));
};
validators
.get_validator_by_slot_band(own_validator_id)
.get_validator_by_slot_band(validator_id)
.address
.clone()
};

let mut futures = FuturesUnordered::new();
for peer_id in self.network.get_peers_by_validator(&our_address) {
for peer_id in self.network.get_peers_by_validator(&validator_address) {
let network = Arc::clone(&self.network);
let msg = msg.clone();
futures.push(async move { network.message(msg, peer_id).await });
Expand Down

0 comments on commit 10e9372

Please sign in to comment.