update if loop

This commit is contained in:
Tan Chee Keong
2025-02-19 22:38:11 +08:00
parent 8c7a995c91
commit 358646cf9b

View File

@@ -137,31 +137,30 @@ async fn make_selection_proof<T: SlotClock + 'static, E: EthSpec>(
// Call the endpoint /eth/v1/validator/beacon_committee_selections // Call the endpoint /eth/v1/validator/beacon_committee_selections
// During the call, we submit a partial selection proof in the data field of the POST HTTP endpoint // During the call, we submit a partial selection proof in the data field of the POST HTTP endpoint
// The end point (middleware) should return a full selection proof // The end point (middleware) should return a full selection proof
let selections = BeaconCommitteeSelection { let selections = BeaconCommitteeSelection {
validator_index: duty.validator_idnex, validator_index: duty.validator_index,
slot: duty.slot, slot: duty.slot,
selection_proof: validator_store selection_proof: validator_store
.produce_selection_proof(duty.pubkey, duty.slot) .produce_selection_proof(duty.pubkey, duty.slot)
.await .await
.map_err(Error::FailedToProduceSelectionProof)?; .map_err(Error::FailedToProduceSelectionProof)?
.into(),
}; };
beacon_nodes beacon_nodes
.first_success(|beacon_node| async move { .first_success(|beacon_node| async move {
beacon_node beacon_node
.post_validator_beacon_committee_selections(selections) .post_validator_beacon_committee_selections(&[selections])
.await .await
}) })
.await .await
.map_err(|e| Error::FailedToProduceSelectionProof(e.to_string())) .map_err(|e| Error::FailedToDownloadAttesters(e.to_string()))?
} else { } else {
validator_store validator_store
.produce_selection_proof(duty.pubkey, duty.slot) .produce_selection_proof(duty.pubkey, duty.slot)
.await .await
.map_err(Error::FailedToProduceSelectionProof)?; .map_err(Error::FailedToProduceSelectionProof)?;
}; };
selection_proof selection_proof
.is_aggregator(duty.committee_length as usize, spec) .is_aggregator(duty.committee_length as usize, spec)
.map_err(Error::InvalidModulo) .map_err(Error::InvalidModulo)