Arc-ify immutable Validator fields

This commit is contained in:
Michael Sproul
2022-03-07 17:33:59 +11:00
parent 73af0b6282
commit f93dfd0c28
9 changed files with 80 additions and 188 deletions

View File

@@ -530,7 +530,7 @@ pub fn serve<T: BeaconChainTypes>(
query.id.as_ref().map_or(true, |ids| {
ids.iter().any(|id| match id {
ValidatorId::PublicKey(pubkey) => {
&validator.pubkey == pubkey
validator.pubkey() == pubkey
}
ValidatorId::Index(param_index) => {
*param_index == *index as u64
@@ -578,7 +578,7 @@ pub fn serve<T: BeaconChainTypes>(
query.id.as_ref().map_or(true, |ids| {
ids.iter().any(|id| match id {
ValidatorId::PublicKey(pubkey) => {
&validator.pubkey == pubkey
validator.pubkey() == pubkey
}
ValidatorId::Index(param_index) => {
*param_index == *index as u64
@@ -635,7 +635,7 @@ pub fn serve<T: BeaconChainTypes>(
.map_state(&chain, |state| {
let index_opt = match &validator_id {
ValidatorId::PublicKey(pubkey) => {
state.validators().iter().position(|v| v.pubkey == *pubkey)
state.validators().iter().position(|v| v.pubkey() == pubkey)
}
ValidatorId::Index(index) => Some(*index as usize),
};