Skip to content

Commit

Permalink
Merge branch 'unstable' into lore/feat/holesky-launch
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevbirb committed Oct 31, 2024
2 parents b656295 + ae6caf3 commit 6bd3917
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions bolt-sidecar/src/client/constraints_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,22 @@ impl BuilderApi for ConstraintsClient {
return Err(BuilderApiError::FailedRegisteringValidators(error));
}

// If there are any delegations, propagate them to the relay
// If there are any delegations, propagate the one associated to the incoming registrations to the relay
if self.delegations.is_empty() {
return Ok(());
} else if let Err(err) = self.delegate(&self.delegations).await {
error!(?err, "Failed to propagate delegations during validator registration");
} else {
let validator_pubkeys =
registrations.iter().map(|r| r.message.public_key.clone()).collect::<HashSet<_>>();
let filtered_delegations = self
.delegations
.iter()
.filter(|d| validator_pubkeys.contains(&d.message.validator_pubkey))
.cloned()
.collect::<Vec<_>>();

if let Err(err) = self.delegate(&filtered_delegations).await {
error!(?err, "Failed to propagate delegations during validator registration");
}
}

Ok(())
Expand Down

0 comments on commit 6bd3917

Please sign in to comment.